Skip to content

Commit 15daddd

Browse files
committed
Remove quote from path.
1 parent 78cdf7b commit 15daddd

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

byte-buddy-agent/src/main/java/net/bytebuddy/agent/ByteBuddyAgent.java

+4-16
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,11 @@ private static void installExternal(AttachmentProvider.Accessor.ExternalAttachme
680680
inputStream.close();
681681
}
682682
}
683-
StringBuilder classPath = new StringBuilder().append(quote((selfResolvedJar == null
683+
StringBuilder classPath = new StringBuilder().append((selfResolvedJar == null
684684
? attachmentJar
685-
: selfResolvedJar).getCanonicalPath()));
685+
: selfResolvedJar).getCanonicalPath());
686686
for (File jar : externalAttachment.getClassPath()) {
687-
classPath.append(File.pathSeparatorChar).append(quote(jar.getCanonicalPath()));
687+
classPath.append(File.pathSeparatorChar).append(jar.getCanonicalPath());
688688
}
689689
if (new ProcessBuilder(System.getProperty(JAVA_HOME)
690690
+ File.separatorChar + "bin"
@@ -694,7 +694,7 @@ private static void installExternal(AttachmentProvider.Accessor.ExternalAttachme
694694
Attacher.class.getName(),
695695
externalAttachment.getVirtualMachineType(),
696696
processId,
697-
quote(agent.getAbsolutePath()),
697+
agent.getAbsolutePath(),
698698
Boolean.toString(isNative),
699699
argument == null ? "" : ("=" + argument)).start().waitFor() != SUCCESSFUL_ATTACH) {
700700
throw new IllegalStateException("Could not self-attach to current VM using external process");
@@ -742,18 +742,6 @@ private static File trySelfResolve() {
742742
}
743743
}
744744

745-
/**
746-
* Quotes a value if it contains a white space.
747-
*
748-
* @param value The value to quote.
749-
* @return The value being quoted if necessary.
750-
*/
751-
private static String quote(String value) {
752-
return value.contains(" ")
753-
? '"' + value + '"'
754-
: value;
755-
}
756-
757745
/**
758746
* Performs the actual lookup of the {@link java.lang.instrument.Instrumentation} from an installed
759747
* Byte Buddy agent and returns the instance, or returns {@code null} if not present.

0 commit comments

Comments
 (0)