JDK-4385195 : Comments(lines with space before #) in property files not ignored
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.3.0,1.3.1,1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_98,windows_2000
  • CPU: generic,x86
  • Submitted: 2000-11-02
  • Updated: 2002-11-11
  • Resolved: 2002-10-26
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.
Other
1.4.2 mantisFixed
Related Reports
Duplicate :  
Description

Name: skT45625			Date: 11/01/2000


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


The following property file
# comment beginning in first column
 # comment with space before #

is read with the program
public class PropTest {
    public static void main(String[] args) {
        Properties p = new Properties();
        try {
            FileInputStream in = new FileInputStream("defaultProperties");
            p.load(in);
            in.close();
        } catch (IOException e) {}
        p.list(System.out);
    }
}

which produces the following output:
-- listing properties --
#=comment with space before #

but the documentation for Properties.load() states:
A line that contains only whitespace or whose first non-whitespace character is
an ASCII # or ! is ignored (thus, # or ! indicate comment lines).

So both lines should be valid comments and be ignored.
(Review ID: 111701) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis mantis-b05 VERIFIED IN: mantis
14-06-2004

WORK AROUND Name: skT45625 Date: 11/01/2000 Don't use whitespace before comment chars ! and #. ======================================================================
11-06-2004

EVALUATION Submitter is correct. This is fixed. ###@###.### 2002-10-15
15-10-2002