RFR: 8231431 - JAOTC issues with JAR path containing spaces
Vladimir Kozlov
vladimir.kozlov at oracle.com
Fri Sep 27 18:26:17 UTC 2019
Okay.
Thanks
Vladimir
> On Sep 27, 2019, at 11:12 AM, Bob Vandette <bob.vandette at oracle.com> wrote:
>
> Please review this updated webrev.
>
> It was suggested by Mikael that I try to use the URI class to scan the file path rather than
> adding special handling for spaces. After some research, I determined that a different URI constructor
> does the job. The URI constructor that takes a String assumes that the passed in string
> is compliant and no special processing is performed.
>
> This solution solves the problem and should be able to handle other special characters
> in addition to spaces.
>
> This fix has been tested on Linux and Windows.
>
> --- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/FileSupport.java
> +++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/FileSupport.java
> @@ -59,7 +59,7 @@
> try {
> String name = path.toAbsolutePath().toString();
> name = name.replace('\\', '/');
> - return new URI("jar:file:///" + name + "!/");
> + return new URI("jar:file", null, "///" + name + "!/", null);
> } catch (URISyntaxException e) {
> throw new InternalError(e);
> }
>
>
> Bob.
>
>
>> On Sep 26, 2019, at 5:45 PM, Vladimir Kozlov <vladimir.kozlov at oracle.com> wrote:
>>
>> Nice.
>>
>> Thanks,
>> Vladimir
>>
>>> On 9/26/19 2:17 PM, Bob Vandette wrote:
>>> Please review this simple fix for creating a jaotc library from jar files that are contained in
>>> directories with spaces in their name.
>>> The fix was verified on Linux and Windows.
>>> BUG:
>>> https://bugs.openjdk.java.net/browse/JDK-8231431
>>> FIX:
>>> diff --git a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/FileSupport.java b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/FileSupport.java
>>> --- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/FileSupport.java
>>> +++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/FileSupport.java
>>> @@ -59,6 +59,7 @@
>>> try {
>>> String name = path.toAbsolutePath().toString();
>>> name = name.replace('\\', '/');
>>> + name = name.replaceAll(" ", "%20");
>>> return new URI("jar:file:///" + name + "!/");
>>> } catch (URISyntaxException e) {
>>> throw new InternalError(e);
>>> Bob.
>
More information about the hotspot-compiler-dev
mailing list