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 DiscoverMappedNames.java
Date Thu, 27 Mar 2003 20:33:42 GMT
rsitze      2003/03/27 12:33:42

  Modified:    discovery/src/java/org/apache/commons/discovery/resource/names
                        DiscoverMappedNames.java
  Log:
  Check for null return before putting results together.
  
  Revision  Changes    Path
  1.4       +9 -3      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DiscoverMappedNames.java	27 Mar 2003 20:24:52 -0000	1.3
  +++ DiscoverMappedNames.java	27 Mar 2003 20:33:41 -0000	1.4
  @@ -110,11 +110,17 @@
           }
           
           final Object obj = mapping.get(resourceName);
  +
  +        final String[] names;
  +        if (obj instanceof String) {
  +            names = new String[] { (String)obj };
  +        } else if (obj instanceof String[]) {
  +            names = (String[])obj;
  +        } else {
  +            names = null;
  +        }
           
           return new ResourceNameIterator() {
  -            String[] names = (obj == null || obj instanceof String)
  -                             ? (new String[] { (String)obj })
  -                             : (String[])obj;
   
               private int idx = 0;
               
  
  
  

---------------------------------------------------------------------
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