langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
changeset 45504 ea7475564d07
parent 44822 2f24758e7ae0
child 45744 db6aedca2c8c
equal deleted inserted replaced
45503:d23ae2d67a5d 45504:ea7475564d07
   213             } else {
   213             } else {
   214                 try {
   214                 try {
   215                     entries.add(getPath(s));
   215                     entries.add(getPath(s));
   216                 } catch (IllegalArgumentException e) {
   216                 } catch (IllegalArgumentException e) {
   217                     if (warn) {
   217                     if (warn) {
   218                         log.warning(LintCategory.PATH, "invalid.path", s);
   218                         log.warning(LintCategory.PATH, Warnings.InvalidPath(s));
   219                     }
   219                     }
   220                 }
   220                 }
   221             }
   221             }
   222         }
   222         }
   223         return entries;
   223         return entries;
   309 
   309 
   310         private void addDirectory(Path dir, boolean warn) {
   310         private void addDirectory(Path dir, boolean warn) {
   311             if (!Files.isDirectory(dir)) {
   311             if (!Files.isDirectory(dir)) {
   312                 if (warn) {
   312                 if (warn) {
   313                     log.warning(Lint.LintCategory.PATH,
   313                     log.warning(Lint.LintCategory.PATH,
   314                             "dir.path.element.not.found", dir);
   314                                 Warnings.DirPathElementNotFound(dir));
   315                 }
   315                 }
   316                 return;
   316                 return;
   317             }
   317             }
   318 
   318 
   319             try (Stream<Path> s = Files.list(dir)) {
   319             try (Stream<Path> s = Files.list(dir)) {
   355 
   355 
   356             if (!fsInfo.exists(file)) {
   356             if (!fsInfo.exists(file)) {
   357                 /* No such file or directory exists */
   357                 /* No such file or directory exists */
   358                 if (warn) {
   358                 if (warn) {
   359                     log.warning(Lint.LintCategory.PATH,
   359                     log.warning(Lint.LintCategory.PATH,
   360                             "path.element.not.found", file);
   360                                 Warnings.PathElementNotFound(file));
   361                 }
   361                 }
   362                 super.add(file);
   362                 super.add(file);
   363                 return;
   363                 return;
   364             }
   364             }
   365 
   365 
   378                          it looks like a valid zip file. */
   378                          it looks like a valid zip file. */
   379                         try {
   379                         try {
   380                             FileSystems.newFileSystem(file, null).close();
   380                             FileSystems.newFileSystem(file, null).close();
   381                             if (warn) {
   381                             if (warn) {
   382                                 log.warning(Lint.LintCategory.PATH,
   382                                 log.warning(Lint.LintCategory.PATH,
   383                                         "unexpected.archive.file", file);
   383                                             Warnings.UnexpectedArchiveFile(file));
   384                             }
   384                             }
   385                         } catch (IOException | ProviderNotFoundException e) {
   385                         } catch (IOException | ProviderNotFoundException e) {
   386                             // FIXME: include e.getLocalizedMessage in warning
   386                             // FIXME: include e.getLocalizedMessage in warning
   387                             if (warn) {
   387                             if (warn) {
   388                                 log.warning(Lint.LintCategory.PATH,
   388                                 log.warning(Lint.LintCategory.PATH,
   389                                         "invalid.archive.file", file);
   389                                             Warnings.InvalidArchiveFile(file));
   390                             }
   390                             }
   391                             return;
   391                             return;
   392                         }
   392                         }
   393                     } else {
   393                     } else {
   394                         if (fsInfo.getJarFSProvider() == null) {
   394                         if (fsInfo.getJarFSProvider() == null) {
   417             try {
   417             try {
   418                 for (Path f : fsInfo.getJarClassPath(jarFile)) {
   418                 for (Path f : fsInfo.getJarClassPath(jarFile)) {
   419                     addFile(f, warn);
   419                     addFile(f, warn);
   420                 }
   420                 }
   421             } catch (IOException e) {
   421             } catch (IOException e) {
   422                 log.error("error.reading.file", jarFile, JavacFileManager.getMessage(e));
   422                 log.error(Errors.ErrorReadingFile(jarFile, JavacFileManager.getMessage(e)));
   423             }
   423             }
   424         }
   424         }
   425     }
   425     }
   426 
   426 
   427     /**
   427     /**