avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/repository/util/src/java/org/apache/avalon/repository/util RepositoryUtils.java
Date Thu, 20 Nov 2003 22:46:30 GMT
mcconnell    2003/11/20 14:46:30

  Modified:    repository/util/src/java/org/apache/avalon/repository/util
                        RepositoryUtils.java
  Log:
  Beef up null test.
  
  Revision  Changes    Path
  1.2       +23 -18    avalon-sandbox/repository/util/src/java/org/apache/avalon/repository/util/RepositoryUtils.java
  
  Index: RepositoryUtils.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/util/src/java/org/apache/avalon/repository/util/RepositoryUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RepositoryUtils.java	20 Nov 2003 04:25:30 -0000	1.1
  +++ RepositoryUtils.java	20 Nov 2003 22:46:29 -0000	1.2
  @@ -88,13 +88,16 @@
        * Attributes object do not have any effect on the Properties object and 
        * vice versa.  All values are copied.
        * 
  -     * @param a_props the properties to be transformed
  +     * @param properties the properties to be transformed
        * @return the Attributes representing the properties
        */
  -    public static Attributes getAsAttributes( Properties a_props )
  +    public static Attributes getAsAttributes( Properties properties )
       {
  +        if( null == properties ) 
  +          throw new NullPointerException( "properties" );
  +
           Attributes l_attrs = new BasicAttributes( false ) ;
  -        Enumeration l_list = a_props.propertyNames() ;
  +        Enumeration l_list = properties.propertyNames() ;
           
           while ( l_list.hasMoreElements() )
           {
  @@ -110,12 +113,12 @@
                       l_attr = new BasicAttribute( l_keyBase, false ) ;
                   }
                   
  -                l_attr.add( a_props.getProperty( l_key ) ) ;
  +                l_attr.add( properties.getProperty( l_key ) ) ;
                   l_attrs.put( l_attr ) ;
               }
               else 
               {
  -                l_attrs.put( l_key, a_props.getProperty( l_key ) ) ;
  +                l_attrs.put( l_key, properties.getProperty( l_key ) ) ;
               }
           }
           
  @@ -127,23 +130,25 @@
        * 
        * @param a_url the url to the properties file
        * @return the loaded properties for the file
  -     * @throws IOException if there is any problem loading the properties
  +     * @throws RepositoryException if there is any problem loading the 
  +     *    properties
        */
  -    public static Properties getProperties( String [] repos, 
  -        Artifact a_artifact ) throws RepositoryException
  +    public static Properties getProperties( 
  +      String [] repositories, Artifact artifact ) 
  +      throws RepositoryException
       {
  -
  -        String[] a_repos = new String[]{};
  -        if( repos != null ) a_repos = repos;
  +        if( null == repositories ) 
  +          throw new NullPointerException( "repositories" );
  +        if( null == artifact ) 
  +          throw new NullPointerException( "artifact" );
   
           Throwable l_throwable = null ;
           Properties l_props = null ;
   
  -        
  -        for( int ii = 0; ii < a_repos.length; ii++ )
  +        for( int ii = 0; ii < repositories.length; ii++ )
           {
               StringBuffer l_buf = new StringBuffer() ;
  -            l_buf.append( a_artifact.getURL( a_repos[ii] ) ) ;
  +            l_buf.append( artifact.getURL( repositories[ii] ) ) ;
               l_buf.append( "." ) ;
               l_buf.append( META ) ;
   
  @@ -160,15 +165,15 @@
           }
   
           StringBuffer l_repos = new StringBuffer() ;
  -        for ( int ii = 0; ii < a_repos.length; ii++ )
  +        for ( int ii = 0; ii < repositories.length; ii++ )
           {
  -            l_repos.append( a_repos[ii] ).append( ',' ) ;
  +            l_repos.append( repositories[ii] ).append( ',' ) ;
           }
   
           throw new RepositoryException( 
               "None of the repositories " + l_repos.toString() 
               + " contained the metadata properties for "
  -            + a_artifact, l_throwable ) ;
  +            + artifact, l_throwable ) ;
       }
       
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message