classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

java.util.Properties#load: Whitespaces before comment characters


From: Ito Kazumitsu
Subject: java.util.Properties#load: Whitespaces before comment characters
Date: Sun, 21 Mar 2004 08:21:39 +0900
User-agent: EMH/1.10.0 SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.2 (i386-unknown-freebsd4.7) MULE/5.0 (SAKAKI)

With reference to java.util.Properties#load, Sun's API document says
"A comment line has an ASCII '#' or '!' as its first non-white space
character;" but GNU Classpath's java.util.Properties checkes only
comment characters at the beginning of ach line.

Here is a patch I comitted in Kaffe.

ChangeLog Entry:
2004-03-19  Ito Kazumitsu <address@hidden>

        * libraries/javalib/java/util/Properties
        (load): Delete leading whiltespaces before checking comment characters.

--- java/util/Properties.java.orig      Thu Mar 18 01:11:02 2004
+++ java/util/Properties.java   Sun Mar 21 07:20:39 2004
@@ -188,17 +188,14 @@
       {
         char c = 0;
         int pos = 0;
-        // If empty line or begins with a comment character, skip this line.
-        if (line.length() == 0
-           || line.charAt(0) == '#' || line.charAt(0) == '!')
-          continue;
-
+       // Leading whitespaces must be deleted first.
         while (pos < line.length()
                && Character.isWhitespace(c = line.charAt(pos)))
           pos++;
 
-        // If line is empty skip this line.
-        if (pos == line.length())
+        // If empty line or begins with a comment character, skip this line.
+        if ((line.length() - pos) == 0
+           || line.charAt(pos) == '#' || line.charAt(pos) == '!')
           continue;
 
         // The characters up to the next Whitespace, ':', or '='




reply via email to

[Prev in Thread] Current Thread [Next in Thread]