donaldp     01/11/21 23:52:05

  Modified:    src/scratchpad/org/apache/avalon/excalibur/extension
                        Extension.java
  Log:
  Improved error messages when version string is invalid.
  
  Submitted By: "Stephen McConnell" <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.7       +22 -4     
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/extension/Extension.java
  
  Index: Extension.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/extension/Extension.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Extension.java    2001/11/22 07:41:46     1.6
  +++ Extension.java    2001/11/22 07:52:05     1.7
  @@ -30,7 +30,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Craig R. McClanahan</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
  - * @version $Revision: 1.6 $ $Date: 2001/11/22 07:41:46 $
  + * @version $Revision: 1.7 $ $Date: 2001/11/22 07:52:05 $
    */
   public final class Extension
   {
  @@ -248,7 +248,16 @@
   
           if( null != specificationVersion )
           {
  -            m_specificationVersion = new DeweyDecimal( specificationVersion 
);
  +            try
  +            {
  +                m_specificationVersion = new DeweyDecimal( 
specificationVersion );
  +            }
  +            catch( NumberFormatException nfe )
  +            {
  +                final String error = "Bad specification version format '" + 
specificationVersion + 
  +                    "' in '" + extensionName + "'. (Reason: " + nfe + ")";
  +                throw new IllegalArgumentException( error );
  +            }
           }
   
           m_implementationURL = implementationURL;
  @@ -257,7 +266,16 @@
   
           if( null != implementationVersion )
           {
  -            m_implementationVersion = new DeweyDecimal( 
implementationVersion );
  +            try
  +            {
  +                m_implementationVersion = new DeweyDecimal( 
implementationVersion );
  +            }
  +            catch( NumberFormatException nfe )
  +            {
  +                final String error = "Bad implementation version format '" + 
implementationVersion +
  +                    "' in '" + extensionName + "'. (Reason: " + nfe + ")";
  +                throw new IllegalArgumentException( error );
  +            }
           }
   
           if( null == m_extensionName )
  @@ -438,7 +456,7 @@
           {
               m_name = name;
           }
  -        
  +
           public String toString()
           {
               return m_name;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to