You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2004/09/23 01:35:03 UTC

cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections ExtendedProperties.java

scolebourne    2004/09/22 16:35:03

  Modified:    collections RELEASE-NOTES.html
               collections/src/java/org/apache/commons/collections
                        ExtendedProperties.java
  Log:
  No longer uses an exception in normal processing
  Bug 30497, reported by John Tal
  
  Revision  Changes    Path
  1.71      +1 -0      jakarta-commons/collections/RELEASE-NOTES.html
  
  Index: RELEASE-NOTES.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/RELEASE-NOTES.html,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- RELEASE-NOTES.html	22 Sep 2004 23:03:50 -0000	1.70
  +++ RELEASE-NOTES.html	22 Sep 2004 23:35:03 -0000	1.71
  @@ -41,6 +41,7 @@
   <ul>
   <li>CollectionUtils.addIgnoreNull - Adds to the collection if the value being added is not null [30020]</li>
   <li>MapUtils.putAll - Puts an array of key/value pairs into a map [30882]</li>
  +<li>ExtendedProperties - No longer uses an exception in normal processing [30497]</li>
   </ul>
   
   <center><h3>BUG FIXES</h3></center>
  
  
  
  1.24      +16 -20    jakarta-commons/collections/src/java/org/apache/commons/collections/ExtendedProperties.java
  
  Index: ExtendedProperties.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ExtendedProperties.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ExtendedProperties.java	21 Jun 2004 23:39:25 -0000	1.23
  +++ ExtendedProperties.java	22 Sep 2004 23:35:03 -0000	1.24
  @@ -361,25 +361,21 @@
            */
           public String readProperty() throws IOException {
               StringBuffer buffer = new StringBuffer();
  -
  -            try {
  -                while (true) {
  -                    String line = readLine().trim();
  -                    if ((line.length() != 0) && (line.charAt(0) != '#')) {
  -                        if (endsWithSlash(line)) {
  -                            line = line.substring(0, line.length() - 1);
  -                            buffer.append(line);
  -                        } else {
  -                            buffer.append(line);
  -                            break;
  -                        }
  +            String line = readLine();
  +            while (line != null) {
  +                line = line.trim();
  +                if ((line.length() != 0) && (line.charAt(0) != '#')) {
  +                    if (endsWithSlash(line)) {
  +                        line = line.substring(0, line.length() - 1);
  +                        buffer.append(line);
  +                    } else {
  +                        buffer.append(line);
  +                        return buffer.toString();  // normal method end
                       }
                   }
  -            } catch (NullPointerException ex) {
  -                return null;
  +                line = readLine();
               }
  -
  -            return buffer.toString();
  +            return null;  // EOF reached
           }
       }
   
  @@ -553,6 +549,9 @@
           try {
               while (true) {
                   String line = reader.readProperty();
  +                if (line == null) {
  +                    return;  // EOF
  +                }
                   int equalSign = line.indexOf('=');
   
                   if (equalSign > 0) {
  @@ -591,9 +590,6 @@
                       }
                   }
               }
  -        } catch (NullPointerException ex) {
  -            // Should happen only when EOF is reached.
  -            return;
           } finally {
               // Loading is initializing
               isInitialized = true;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org