getImpliedDependents() {
diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java
index bde1562250..8a7269bfb1 100644
--- a/core/src/main/java/hudson/Util.java
+++ b/core/src/main/java/hudson/Util.java
@@ -890,6 +890,20 @@ public class Util {
// queryMap[38] = queryMap[43] = queryMap[61] = true;
}
+ private static final boolean[] fullUriMap = new boolean[123];
+ static {
+ String raw = " 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz";
+ // !"#$%&'()*+,-./0123456789:;<=>?@ [\]^_` {|}~
+ // ^--so these are encoded
+ int i;
+ // Encode control chars and space
+ for (i = 0; i < 33; i++) fullUriMap[i] = true;
+ for (int j = 0; j < raw.length(); i++, j++)
+ fullUriMap[i] = raw.charAt(j) == ' ';
+ // If we add encodeQuery() just add a 2nd map to encode &+=
+ // queryMap[38] = queryMap[43] = queryMap[61] = true;
+ }
+
/**
* Encode a single path component for use in an HTTP URL.
* Escapes all non-ASCII, general unsafe (space and {@code "#%<>[\]^`{|}~})
@@ -901,6 +915,23 @@ public class Util {
*/
@NonNull
public static String rawEncode(@NonNull String s) {
+ return encode(s, uriMap);
+ }
+
+ /**
+ * Encode a single path component for use in an HTTP URL.
+ * Escapes all special characters including those outside
+ * of the characters specified in RFC1738.
+ * All characters outside numbers and letters without diacritic are encoded.
+ * Note that slash ({@code /}) is encoded, so the given string should be a
+ * single path component used in constructing a URL.
+ */
+ @NonNull
+ public static String fullEncode(@NonNull String s){
+ return encode(s, fullUriMap);
+ }
+
+ private static String encode(String s, boolean[] map){
boolean escaped = false;
StringBuilder out = null;
CharsetEncoder enc = null;
@@ -910,7 +941,7 @@ public class Util {
int codePoint = Character.codePointAt(s, i);
if((codePoint&0xffffff80)==0) { // 1 byte
c = s.charAt(i);
- if (c > 122 || uriMap[c]) {
+ if (c > 122 || map[c]) {
if (!escaped) {
out = new StringBuilder(i + (m - i) * 3);
out.append(s, 0, i);
@@ -1805,16 +1836,4 @@ public class Util {
private static PathRemover newPathRemover(@NonNull PathRemover.PathChecker pathChecker) {
return PathRemover.newFilteredRobustRemover(pathChecker, DELETION_RETRIES, GC_AFTER_FAILED_DELETE, WAIT_BETWEEN_DELETION_RETRIES);
}
-
- /**
- * If this flag is true, native implementations of {@link FilePath#chmod}
- * and {@link hudson.util.IOUtils#mode} are used instead of NIO.
- *
- * This should only be enabled if the setgid/setuid/sticky bits are
- * intentionally set on the Jenkins installation and they are being
- * overwritten by Jenkins erroneously.
- */
- @Restricted(value = NoExternalUse.class)
- @SuppressFBWarnings("MS_SHOULD_BE_FINAL")
- public static boolean NATIVE_CHMOD_MODE = SystemProperties.getBoolean(Util.class.getName() + ".useNativeChmodAndMode");
}
diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java
index 6eab71e566..1f88bae7cb 100644
--- a/core/src/main/java/hudson/WebAppMain.java
+++ b/core/src/main/java/hudson/WebAppMain.java
@@ -341,7 +341,7 @@ public class WebAppMain implements ServletContextListener {
*/
private void recordBootAttempt(File home) {
try (OutputStream o=Files.newOutputStream(BootFailure.getBootFailureFile(home).toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND)) {
- o.write((new Date().toString() + System.getProperty("line.separator", "\n")).getBytes());
+ o.write((new Date() + System.getProperty("line.separator", "\n")).getBytes());
} catch (IOException | InvalidPathException e) {
LOGGER.log(WARNING, "Failed to record boot attempts",e);
}
diff --git a/core/src/main/java/hudson/XmlFile.java b/core/src/main/java/hudson/XmlFile.java
index d203806906..3e53cd5d19 100644
--- a/core/src/main/java/hudson/XmlFile.java
+++ b/core/src/main/java/hudson/XmlFile.java
@@ -33,6 +33,8 @@ import hudson.diagnosis.OldDataMonitor;
import hudson.model.Descriptor;
import hudson.util.AtomicFileWriter;
import hudson.util.XStream2;
+import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import org.xml.sax.Attributes;
@@ -118,6 +120,7 @@ import org.apache.commons.io.IOUtils;
public final class XmlFile {
private final XStream xs;
private final File file;
+ private final boolean force;
private static final Map