You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/08/25 23:34:03 UTC

cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/parse SpecificationParser.java

hlship      2005/08/25 14:34:02

  Modified:    .        status.xml
               framework/src/java/org/apache/tapestry/util/xml
                        RuleDirectedParser.java DocumentParseException.java
               framework/src/test/org/apache/tapestry/junit/mock
                        MockTester.java
               framework/src/java/org/apache/tapestry/parse
                        SpecificationParser.java
  Log:
  TAPESTRY-560: Poor reporting of missing specification file
  
  Revision  Changes    Path
  1.229     +2 -1      jakarta-tapestry/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/status.xml,v
  retrieving revision 1.228
  retrieving revision 1.229
  diff -u -r1.228 -r1.229
  --- status.xml	25 Aug 2005 19:43:04 -0000	1.228
  +++ status.xml	25 Aug 2005 21:34:02 -0000	1.229
  @@ -78,7 +78,8 @@
         <action type="fix" dev="HLS" fixes-bug="TAPESTRY-222">IE Error in DataPicker.js</action>
         <action type="fix" dev="PF" fixes-bug="TAPESTRY-586">Do not bind form component values unless all validators succeed.</action>
         <action type="fix" dev="HLS" fixes-bug="TAPESTRY-588">Including the tapestry-portlet jar in the classpath for a servlet application causes exceptions</action>
  -      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-592">Optimize generated JavaScript to reduce the verbosity</action>    
  +      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-592">Optimize generated JavaScript to reduce the verbosity</action>  
  +      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-560">Poor reporting of missing specification file</action>  
       </release>
       <release version="4.0-beta-4" date="Aug 10 2005">
         <action type="fix" dev="HLS">Add getComponent() method to IComponent.</action>
  
  
  
  1.5       +2 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/util/xml/RuleDirectedParser.java
  
  Index: RuleDirectedParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/util/xml/RuleDirectedParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RuleDirectedParser.java	6 Jan 2005 02:17:18 -0000	1.4
  +++ RuleDirectedParser.java	25 Aug 2005 21:34:02 -0000	1.5
  @@ -125,7 +125,7 @@
               if (url == null)
                   throw new DocumentParseException(Tapestry.format(
                           "RuleDrivenParser.resource-missing",
  -                        documentLocation), documentLocation, null);
  +                        documentLocation), documentLocation);
   
               return parse(url);
           }
  @@ -335,7 +335,7 @@
           if (rule == null)
               throw new DocumentParseException(Tapestry.format(
                       "RuleDrivenParser.no-rule-for-element",
  -                    localName), getLocation(), null);
  +                    localName), getLocation());
   
           return rule;
       }
  
  
  
  1.6       +15 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/util/xml/DocumentParseException.java
  
  Index: DocumentParseException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/util/xml/DocumentParseException.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DocumentParseException.java	7 Mar 2005 19:51:54 -0000	1.5
  +++ DocumentParseException.java	25 Aug 2005 21:34:02 -0000	1.6
  @@ -30,11 +30,21 @@
   
   public class DocumentParseException extends ApplicationRuntimeException
   {
  +    public DocumentParseException(String message)
  +    {
  +        this(message, (Resource) null);
  +    }
  +
       public DocumentParseException(String message, Throwable rootCause)
       {
           super(message, null, rootCause);
       }
   
  +    public DocumentParseException(String message, Location location)
  +    {
  +        super(message, location, null);
  +    }
  +
       public DocumentParseException(String message, Location location, Throwable rootCause)
       {
           super(message, location, rootCause);
  @@ -46,6 +56,11 @@
                   .getLineNumber(), rootCause.getColumnNumber()), rootCause);
       }
   
  +    public DocumentParseException(String message, Resource resource)
  +    {
  +        this(message, resource, (Throwable) null);
  +    }
  +
       public DocumentParseException(String message, Resource resource, Throwable rootCause)
       {
           this(message, resource == null ? null : new LocationImpl(resource), rootCause);
  
  
  
  1.6       +6 -5      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/MockTester.java
  
  Index: MockTester.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/MockTester.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MockTester.java	7 Mar 2005 19:51:58 -0000	1.5
  +++ MockTester.java	25 Aug 2005 21:34:02 -0000	1.6
  @@ -34,6 +34,7 @@
   
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.HiveMind;
  +import org.apache.hivemind.Resource;
   import org.apache.oro.text.regex.MalformedPatternException;
   import org.apache.oro.text.regex.MatchResult;
   import org.apache.oro.text.regex.Pattern;
  @@ -450,7 +451,7 @@
   
           throw new DocumentParseException("Expression '" + expression + "' evaluates to ("
                   + value.getClass().getName() + ") " + value
  -                + ", which cannot be interpreted as a boolean.", null);
  +                + ", which cannot be interpreted as a boolean.");
       }
   
       /**
  @@ -475,7 +476,7 @@
               String pattern = a.getTextTrim();
   
               if (HiveMind.isBlank(pattern))
  -                throw new DocumentParseException("Pattern is null in " + a, null);
  +                throw new DocumentParseException("Pattern is null in " + a);
   
               if (outputString == null)
                   outputString = _response.getOutputString();
  @@ -507,7 +508,7 @@
               String substring = a.getTextTrim();
   
               if (HiveMind.isBlank(substring))
  -                throw new DocumentParseException("Substring is null in " + a, null);
  +                throw new DocumentParseException("Substring is null in " + a);
   
               if (outputString == null)
                   outputString = _response.getOutputString();
  @@ -539,7 +540,7 @@
               String substring = a.getTextTrim();
   
               if (HiveMind.isBlank(substring))
  -                throw new DocumentParseException("Substring is null in " + a, null);
  +                throw new DocumentParseException("Substring is null in " + a, (Resource) null);
   
               if (outputString == null)
                   outputString = _response.getOutputString();
  @@ -653,7 +654,7 @@
           String pattern = element.getTextTrim();
   
           if (HiveMind.isBlank(pattern))
  -            throw new DocumentParseException("Pattern is null in " + element, null);
  +            throw new DocumentParseException("Pattern is null in " + element);
   
           PatternMatcherInput input = new PatternMatcherInput(outputString);
   
  
  
  
  1.33      +5 -8      jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java
  
  Index: SpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- SpecificationParser.java	6 Aug 2005 06:58:25 -0000	1.32
  +++ SpecificationParser.java	25 Aug 2005 21:34:02 -0000	1.33
  @@ -792,7 +792,7 @@
           IContainedComponent source = cs.getComponent(sourceComponentId);
           if (source == null)
               throw new DocumentParseException(ParseMessages.unableToCopy(sourceComponentId),
  -                    getLocation(), null);
  +                    getLocation());
   
           Iterator i = source.getBindingNames().iterator();
           while (i.hasNext())
  @@ -1109,14 +1109,13 @@
           if (hasCopyOf)
           {
               if (HiveMind.isNonBlank(type))
  -                throw new DocumentParseException(ParseMessages.bothTypeAndCopyOf(id),
  -                        getLocation(), null);
  +                throw new DocumentParseException(ParseMessages.bothTypeAndCopyOf(id), getLocation());
           }
           else
           {
               if (HiveMind.isBlank(type))
                   throw new DocumentParseException(ParseMessages.missingTypeOrCopyOf(id),
  -                        getLocation(), null);
  +                        getLocation());
           }
   
           IContainedComponent cc = _factory.createContainedComponent();
  @@ -1249,8 +1248,7 @@
           if (libraryId.equals(INamespace.FRAMEWORK_NAMESPACE)
                   || libraryId.equals(INamespace.APPLICATION_NAMESPACE))
               throw new DocumentParseException(ParseMessages
  -                    .frameworkLibraryIdIsReserved(INamespace.FRAMEWORK_NAMESPACE), getLocation(),
  -                    null);
  +                    .frameworkLibraryIdIsReserved(INamespace.FRAMEWORK_NAMESPACE), getLocation());
   
           ILibrarySpecification ls = (ILibrarySpecification) peekObject();
   
  @@ -1674,8 +1672,7 @@
               URL resourceURL = resource.getResourceURL();
   
               if (resourceURL == null)
  -                throw new DocumentParseException(ParseMessages.missingResource(resource), resource,
  -                        null);
  +                throw new DocumentParseException(ParseMessages.missingResource(resource), resource);
   
               InputStream rawStream = resourceURL.openStream();
               stream = new BufferedInputStream(rawStream);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org