RFR 8189657: LineBrokenMultiByteCharacter.java fails on some systems that does not accept a non-ASCII char in Path

Weijun Wang weijun.wang at oracle.com
Fri Oct 20 05:44:30 UTC 2017


False alarm! Turns out I introduced the bug in another change I am still working on. I'll close this bug.

--Max

> On Oct 19, 2017, at 2:45 PM, Weijun Wang <weijun.wang at oracle.com> wrote:
> 
> Please review this patch:
> 
> $ hg qdiff -wb
> diff --git a/test/lib/jdk/test/lib/util/JarUtils.java b/test/lib/jdk/test/lib/util/JarUtils.java
> --- a/test/lib/jdk/test/lib/util/JarUtils.java
> +++ b/test/lib/jdk/test/lib/util/JarUtils.java
> @@ -28,6 +28,7 @@
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.nio.file.Files;
> +import java.nio.file.InvalidPathException;
> import java.nio.file.Path;
> import java.nio.file.Paths;
> import java.util.Enumeration;
> @@ -88,12 +89,17 @@
>             if (file.equals("-")) {
>                 update = false;
>             } else if (update) {
> +                try {
>                 Path p = Paths.get(file);
>                 if (Files.exists(p)) {
>                     changes.put(file, p);
>                 } else {
>                     changes.put(file, file);
>                 }
> +                } catch (InvalidPathException e) {
> +                    // Fallback if file not a valid Path.
> +                    changes.put(file, file);
> +                }
>             } else {
>                 changes.put(file, Boolean.FALSE);
>             }
> 
> This is a part of the JarUtils::updateJar method. When it adds a new entry into a jar, it will add the actual file if a file with the entry name exists, and fabricate some content if not. Unfortunately just creating a Path object on some systems would fail.
> 
> Noreg-self.
> 
> Thanks
> Max
> 




More information about the security-dev mailing list