JDK-6625520 : javac handles missing entries on classpath badly
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-11-02
  • Updated: 2012-01-13
  • Resolved: 2012-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b31Fixed OpenJDK6Fixed
Related Reports
Relates :  
Description
In DefaultFileManager, getFileForInput assumes that if a path entry is not a directory, it must be an archive. This applies even if it does not exist.

Separately, openArchive assumes FileNotFoundException will be thrown if the archive is missing.   This may be true on some systems, but is not required to be true. For example, on Ubuntu linux, you get java.io.IOException if a file is not found.  This causes a spurious diagnostic to be generated.

Comments
EVALUATION The bug has been partially masked by the changes to use zip file archives, which protect openArchive from being called if the file does not exist. However, there is still exposure in the JSR199 API method getFileForInput. However, even then, the bug is hard to reproduce because Ubuntu Linux now seems to give FileNotFoundException, as expected. Nevertheless the suggested fix is deemed worthy, in case there are other platforms on which the problem may arise.
17-06-2008

SUGGESTED FIX In openArchive check if file exists before outputting message about trouble reading it: try { ZipFile zdir = new ZipFile(zipFileName); if (origZipFileName == zipFileName) archive = new ZipArchive(zdir); else archive = new SymbolArchive(origZipFileName, zdir); } catch (FileNotFoundException ex) { archive = new MissingArchive(zipFileName); } catch (IOException ex) { >>>>>>>>>>> if (zipFileName.exists()) log.error("error.reading.file", zipFileName, ex.getLocalizedMessage()); archive = new MissingArchive(zipFileName); } This would make the handling of "IOException/file doesn't exist" the same as the handling of FileNotFoundException.
02-11-2007