8177332: The presence of a file with a Japanese ShiftJIS name can cause javac to fail
authorvromero
Tue, 04 Apr 2017 15:15:59 -0700
changeset 44566 db270eef83ae
parent 44565 41071e253324
child 44567 126285be00b9
8177332: The presence of a file with a Japanese ShiftJIS name can cause javac to fail Reviewed-by: jjg, jlahoda
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Tue Apr 04 14:06:54 2017 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Tue Apr 04 15:15:59 2017 -0700
@@ -473,10 +473,14 @@
                     }
                 } else {
                     if (isValidFile(fname, fileKinds)) {
-                        RelativeFile file = new RelativeFile(subdirectory, fname);
-                        JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this,
-                                file.resolveAgainst(directory), userPath, file);
-                        resultList.append(fe);
+                        try {
+                            RelativeFile file = new RelativeFile(subdirectory, fname);
+                            JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this,
+                                    file.resolveAgainst(directory), userPath, file);
+                            resultList.append(fe);
+                        } catch (InvalidPathException e) {
+                            throw new IOException("error accessing directory " + directory + e);
+                        }
                     }
                 }
             }