United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4385195 : Comments(lines with space before #) in property files not ignored

Details
Type:
Bug
Submit Date:
2000-11-02
Status:
Closed
Updated Date:
2002-11-11
Project Name:
JDK
Resolved Date:
2002-10-26
Component:
core-libs
OS:
generic,windows_98,windows_2000
Sub-Component:
java.util
CPU:
x86,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.3.0,1.3.1,1.4.1
Fixed Versions:
1.4.2 (mantis)

Related Reports
Duplicate:

Sub Tasks

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
EVALUATION

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



Name: skT45625			Date: 11/01/2000


Don't use whitespace before comment chars ! and #.
======================================================================
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis
mantis-b05

VERIFIED IN:
mantis


                                     
2004-06-14



Hardware and Software, Engineered to Work Together