ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property DefaultNameValidator.java
Date Sun, 05 May 2002 13:51:51 GMT
donaldp     02/05/05 06:51:51

  Modified:    container/src/java/org/apache/myrmidon/components/property
                        DefaultNameValidator.java
  Log:
  Add in UGLY special case so that target with name "<init>" is declared as having a
valid name.
  
  Revision  Changes    Path
  1.2       +17 -6     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/DefaultNameValidator.java
  
  Index: DefaultNameValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/DefaultNameValidator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultNameValidator.java	2 May 2002 10:52:19 -0000	1.1
  +++ DefaultNameValidator.java	5 May 2002 13:51:51 -0000	1.2
  @@ -16,7 +16,7 @@
    * in ant projects.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.1 $ $Date: 2002/05/02 10:52:19 $
  + * @version $Revision: 1.2 $ $Date: 2002/05/05 13:51:51 $
    */
   public class DefaultNameValidator
       implements NameValidator
  @@ -84,7 +84,7 @@
        * characters. If no valid characters are present, an exception is thrown.
        * @param baseName the name used to construct the valid name
        * @return a valid name based on the supplied name.
  -     * @throws java.lang.Exception if no valid name could be constructed.
  +     * @throws Exception if no valid name could be constructed.
        */
       public String makeValidName( final String baseName ) throws Exception
       {
  @@ -95,7 +95,9 @@
           }
           if( buffer.length() == 0 )
           {
  -            final String message = REZ.getString( "name.could-not-create.error", baseName
);
  +            final String message =
  +                REZ.getString( "name.could-not-create.error",
  +                               baseName );
               throw new Exception( message );
           }
   
  @@ -117,8 +119,15 @@
       /**
        * @see org.apache.myrmidon.interfaces.property.NameValidator
        */
  -    public void validate( final String name ) throws Exception
  +    public void validate( final String name )
  +        throws Exception
       {
  +        //Add in special case for "init" target.
  +        if( "<init>".equals( name ) )
  +        {
  +            return;
  +        }
  +
           String testName = name;
   
           // If surrounding whitespace is allowed, trim it. Otherwise, check.
  @@ -134,7 +143,8 @@
           // Zero-length name is invalid.
           if( testName.length() == 0 )
           {
  -            final String message = REZ.getString( "name.zero-char-name.error" );
  +            final String message =
  +                REZ.getString( "name.zero-char-name.error" );
               throw new Exception( message );
           }
   
  @@ -159,7 +169,8 @@
       {
           if( !isValidInternalChar( internal ) )
           {
  -            final String message = REZ.getString( "name.invalid-internal-char.error",
  +            final String message =
  +                REZ.getString( "name.invalid-internal-char.error",
                                                     name,
                                                     describeValidInternalChars() );
               throw new Exception( message );
  
  
  

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


Mime
View raw message