avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/configuration/validator JarvConfigurationValidator.java
Date Mon, 15 Jul 2002 16:17:46 GMT
proyal      2002/07/15 09:17:46

  Modified:    src/java/org/apache/avalon/phoenix/components/application
                        BlockEntry.java BlockInvocationHandler.java
               src/java/org/apache/avalon/phoenix/components/configuration/validator
                        JarvConfigurationValidator.java
  Log:
  Fixed Checkstyle errors
  
  Revision  Changes    Path
  1.17      +1 -0      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/BlockEntry.java
  
  Index: BlockEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/BlockEntry.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- BlockEntry.java	18 Jun 2002 05:21:04 -0000	1.16
  +++ BlockEntry.java	15 Jul 2002 16:17:46 -0000	1.17
  @@ -92,6 +92,7 @@
               }
               catch( final Throwable throwable )
               {
  +                //Ignore
               }
           }
   
  
  
  
  1.6       +3 -3      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/BlockInvocationHandler.java
  
  Index: BlockInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/BlockInvocationHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BlockInvocationHandler.java	10 May 2002 02:43:03 -0000	1.5
  +++ BlockInvocationHandler.java	15 Jul 2002 16:17:46 -0000	1.6
  @@ -97,8 +97,8 @@
           }
           else
           {
  -            throw new IllegalStateException( "Using a stale object reference " +
  -                                             "to call a disposed Block." );
  +            throw new IllegalStateException( "Using a stale object reference "
  +                                             + "to call a disposed Block." );
           }
       }
   }
  
  
  
  1.2       +56 -30    jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/configuration/validator/JarvConfigurationValidator.java
  
  Index: JarvConfigurationValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/configuration/validator/JarvConfigurationValidator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JarvConfigurationValidator.java	13 Jul 2002 19:48:21 -0000	1.1
  +++ JarvConfigurationValidator.java	15 Jul 2002 16:17:46 -0000	1.2
  @@ -22,9 +22,9 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer;
  -import org.apache.excalibur.configuration.ConfigurationUtil;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.phoenix.interfaces.ConfigurationValidator;
  +import org.apache.excalibur.configuration.ConfigurationUtil;
   
   import org.iso_relax.verifier.Schema;
   import org.iso_relax.verifier.Verifier;
  @@ -39,16 +39,18 @@
    * @author <a href="mailto:proyal@apache.org">Peter Royal</a>
    */
   public class JarvConfigurationValidator extends AbstractLogEnabled
  -  implements Configurable, Initializable, ConfigurationValidator
  +    implements Configurable, Initializable, ConfigurationValidator
   {
       private static final Resources REZ =
  -      ResourceManager.getPackageResources( JarvConfigurationValidator.class );
  +        ResourceManager.getPackageResources( JarvConfigurationValidator.class );
   
       private String m_schemaType;
       private String m_schemaLanguage;
       private String m_verifierFactoryClass;
   
  -    private final DefaultConfigurationSerializer m_serializer = new DefaultConfigurationSerializer();
  +    private final DefaultConfigurationSerializer m_serializer =
  +        new DefaultConfigurationSerializer();
  +
       private final Map m_schemas = Collections.synchronizedMap( new HashMap() );
       private VerifierFactory m_verifierFactory;
   
  @@ -64,21 +66,22 @@
        * @see http://iso-relax.sourceforge.net/apiDoc/org/iso_relax/verifier/VerifierFactory.html#newInstance(java.lang.String)
        */
       public void configure( Configuration configuration )
  -      throws ConfigurationException
  +        throws ConfigurationException
       {
           this.m_schemaType = configuration.getAttribute( "schema-type" );
           this.m_schemaLanguage = configuration.getChild( "schema-language" ).getValue( null
);
  -        this.m_verifierFactoryClass = configuration.getChild( "verifier-factory-class"
).getValue( null );
  +        this.m_verifierFactoryClass =
  +            configuration.getChild( "verifier-factory-class" ).getValue( null );
   
           if( ( null == this.m_schemaLanguage && null == this.m_verifierFactoryClass
)
  -          || ( null != this.m_schemaLanguage && null != this.m_verifierFactoryClass
) )
  +            || ( null != this.m_schemaLanguage && null != this.m_verifierFactoryClass
) )
           {
               throw new ConfigurationException( REZ.getString( "jarv.error.badconfig" ) );
           }
       }
   
       public void initialize()
  -      throws Exception
  +        throws Exception
       {
           if( null != this.m_schemaLanguage )
           {
  @@ -86,7 +89,8 @@
           }
           else if( null != this.m_verifierFactoryClass )
           {
  -            this.m_verifierFactory = ( VerifierFactory ) Class.forName( this.m_verifierFactoryClass
).newInstance();
  +            this.m_verifierFactory =
  +                ( VerifierFactory ) Class.forName( this.m_verifierFactoryClass ).newInstance();
           }
       }
   
  @@ -96,20 +100,25 @@
       }
   
       public void addSchema( String application, String block, String schemaType, String
url )
  -      throws ConfigurationException
  +        throws ConfigurationException
       {
           if( !this.m_schemaType.equals( schemaType ) )
           {
  -            throw new ConfigurationException( REZ.getString( "jarv.error.badtype", schemaType,
this.m_schemaType ) );
  +            final String msg = REZ.getString( "jarv.error.badtype", schemaType, this.m_schemaType
);
  +
  +            throw new ConfigurationException( msg );
           }
   
           try
           {
  -            this.m_schemas.put( createKey( application, block ), this.m_verifierFactory.compileSchema(
url ) );
  +            this.m_schemas.put( createKey( application, block ),
  +                                this.m_verifierFactory.compileSchema( url ) );
           }
           catch( VerifierConfigurationException e )
           {
  -            throw new ConfigurationException( REZ.getString( "jarv.error.schema.create",
application, block, url ), e );
  +            final String msg = REZ.getString( "jarv.error.schema.create", application,
block, url );
  +
  +            throw new ConfigurationException( msg, e );
           }
           catch( SAXParseException e )
           {
  @@ -123,28 +132,35 @@
           }
           catch( Exception e )
           {
  -            throw new ConfigurationException( REZ.getString( "jarv.error.schema", application,
block, url ), e );
  +            final String msg = REZ.getString( "jarv.error.schema", application, block,
url );
  +
  +            throw new ConfigurationException( msg, e );
           }
   
           if( getLogger().isDebugEnabled() )
  -            getLogger().debug( "Created schema [app: " + application + ", block: " + block
+ ", url: " + url + "]" );
  +            getLogger().debug( "Created schema [app: " + application + ", block: " + block
  +                               + ", url: " + url + "]" );
       }
   
       //JARV does not support feasability validation
       public boolean isFeasiblyValid( String application, String block, Configuration configuration
)
  -      throws ConfigurationException
  +        throws ConfigurationException
       {
           return true;
       }
   
  -    public boolean isValid( final String application, final String block, Configuration
configuration )
  -      throws ConfigurationException
  +    public boolean isValid( final String application,
  +                            final String block,
  +                            final Configuration configuration )
  +        throws ConfigurationException
       {
           final Schema schema = ( Schema ) this.m_schemas.get( createKey( application, block
) );
   
           if( null == schema )
           {
  -            throw new ConfigurationException( REZ.getString( "jarv.error.noschema", application,
block ) );
  +            final String msg = REZ.getString( "jarv.error.noschema", application, block
);
  +
  +            throw new ConfigurationException( msg );
           }
   
           try
  @@ -155,53 +171,63 @@
               verifier.setErrorHandler( new ErrorHandler()
               {
                   public void warning( SAXParseException exception )
  -                  throws SAXException
  +                    throws SAXException
                   {
                       if( getLogger().isWarnEnabled() )
  -                        getLogger().warn( "Valdating configuration [app: " + application
+ ", block: " + block
  +                        getLogger().warn( "Valdating configuration [app: " + application
  +                                          + ", block: " + block
                                             + ", msg: " + exception.getMessage() + "]" );
                   }
   
                   public void error( SAXParseException exception )
  -                  throws SAXException
  +                    throws SAXException
                   {
                       if( getLogger().isErrorEnabled() )
  -                        getLogger().error( "Valdating configuration [app: " + application
+ ", block: " + block
  +                        getLogger().error( "Valdating configuration [app: " + application
  +                                           + ", block: " + block
                                              + ", msg: " + exception.getMessage() + "]" );
                   }
   
                   public void fatalError( SAXParseException exception )
  -                  throws SAXException
  +                    throws SAXException
                   {
                       if( getLogger().isFatalErrorEnabled() )
  -                        getLogger().fatalError( "Valdating configuration [app: " + application
+ ", block: " + block
  +                        getLogger().fatalError( "Valdating configuration [app: " + application
  +                                                + ", block: " + block
                                                   + ", msg: " + exception.getMessage() +
"]" );
   
                   }
               } );
   
  -            this.m_serializer.serialize( handler, ConfigurationUtil.branch( configuration,
"root" ) );
  +            this.m_serializer.serialize( handler,
  +                                         ConfigurationUtil.branch( configuration, "root"
) );
   
               return handler.isValid();
           }
           catch( VerifierConfigurationException e )
           {
  -            throw new ConfigurationException( REZ.getString( "jarv.valid.schema", application,
block ), e );
  +            final String msg = REZ.getString( "jarv.valid.schema", application, block );
  +
  +            throw new ConfigurationException( msg, e );
           }
           catch( SAXException e )
           {
  -            throw new ConfigurationException( REZ.getString( "jarv.valid.badparse", application,
block ), e );
  +            final String msg = REZ.getString( "jarv.valid.badparse", application, block
);
  +
  +            throw new ConfigurationException( msg, e );
           }
           catch( IllegalStateException e )
           {
  -            throw new ConfigurationException( REZ.getString( "jarv.valid.badparse", application,
block ), e );
  +            final String msg = REZ.getString( "jarv.valid.badparse", application, block
);
  +
  +            throw new ConfigurationException( msg, e );
           }
       }
   
       public void removeSchema( String application, String block )
       {
           if( null != this.m_schemas.remove( createKey( application, block ) )
  -          && getLogger().isDebugEnabled() )
  +            && getLogger().isDebugEnabled() )
               getLogger().debug( "Removed schema [app: " + application + ", block: " + block
+ "]" );
       }
   }
  
  
  

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


Mime
View raw message