commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsi...@apache.org
Subject cvs commit: jakarta-commons/discovery/src/java/org/apache/commons/discovery/resource/names DiscoverNamesInDictionary.java DiscoverMappedNames.java
Date Thu, 27 Mar 2003 20:24:52 GMT
rsitze      2003/03/27 12:24:52

  Modified:    discovery/src/java/org/apache/commons/discovery/resource/names
                        DiscoverNamesInDictionary.java
                        DiscoverMappedNames.java
  Log:
  skip null-values in result vectors.
  
  Revision  Changes    Path
  1.4       +8 -2      jakarta-commons/discovery/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
  
  Index: DiscoverNamesInDictionary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/discovery/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DiscoverNamesInDictionary.java	8 Jan 2003 01:52:17 -0000	1.3
  +++ DiscoverNamesInDictionary.java	27 Mar 2003 20:24:51 -0000	1.4
  @@ -139,11 +139,17 @@
               private int idx = 0;
               
               public boolean hasNext() {
  -                return (resources != null && idx < resources.length);
  +                if (resources != null) {
  +                    while (idx < resources.length  &&  resources[idx] == null)
{
  +                        idx++;
  +                    }
  +                    return idx < resources.length;
  +                }
  +                return false;
               }
               
               public String nextResourceName() {
  -                return resources[idx++];
  +                return hasNext() ? resources[idx++] : null;
               }
           };
       }
  
  
  
  1.3       +7 -1      jakarta-commons/discovery/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java
  
  Index: DiscoverMappedNames.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/discovery/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DiscoverMappedNames.java	8 Jan 2003 01:52:17 -0000	1.2
  +++ DiscoverMappedNames.java	27 Mar 2003 20:24:52 -0000	1.3
  @@ -119,7 +119,13 @@
               private int idx = 0;
               
               public boolean hasNext() {
  -                return idx < names.length;
  +                if (names != null) {
  +                    while (idx < names.length  &&  names[idx] == null) {
  +                        idx++;
  +                    }
  +                    return idx < names.length;
  +                }
  +                return false;
               }
               
               public String nextResourceName() {
  
  
  

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


Mime
View raw message