United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6930076 "null" can incorrectly appear in error message compiler.err.error.reading.file
6930076 : "null" can incorrectly appear in error message compiler.err.error.reading.file

Details
Type:
Bug
Submit Date:
2010-02-25
Status:
Closed
Updated Date:
2011-10-07
Project Name:
JDK
Resolved Date:
2011-10-07
Component:
tools
OS:
generic
Sub-Component:
javac
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
7

Related Reports
Backport:

Sub Tasks

Description
The following message has been seen in a test that was timing out

error: error reading /net/jano2.sfbay/export2/tl/ws-depot/7/repo.latest-pit/langtools/test/tools/javac/nio/compileTest/HelloPathWorld.java; null

Note the "null" at the end.  This is an error.

[The test is test/tools/javac/nio/compileTest/CompileTest.java]

                                    

Comments
EVALUATION

The structure of the error message is indicative of this entry in the resource file:

compiler.err.error.reading.file=\
    error reading {0}; {1}

Searching for the compiler sources for "error.reading.file" reveals 5 instances.

In all cases, the usage is within catch (IOException e) { ... }

In 4/5 cases, the second arg is e.getLocalizedMessage().   In the last case, the second arg is simply e.

Since e cannot be null, we must have a case where e.getLocalizedMessage() is null.
The default impl of getLocalizedMessage() returns getMessage().

As a result, in all cases, it is suggested that e.getLocalizedMessage() is used if not null, and e is used if e.getLocalizedMessage() is null.
                                     
2010-02-26



Hardware and Software, Engineered to Work Together