commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/validators XPathValidator.java
Date Sun, 05 May 2002 06:59:49 GMT
dion        02/05/04 23:59:49

  Modified:    latka/src/java/org/apache/commons/latka/validators
                        XPathValidator.java
  Log:
  Added exception handling to allow Gump builds to proceed. JDOM b8 doesn't throw IOExceptions,
  but the latest code in CVS does.
  The compiler wont let you catch an exception that isn't being thrown, so simply
  adding catch IOException to the code would break people build on released versions of jdom.
  Hence the ugly workaround
  
  Revision  Changes    Path
  1.5       +9 -4      jakarta-commons/latka/src/java/org/apache/commons/latka/validators/XPathValidator.java
  
  Index: XPathValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/validators/XPathValidator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XPathValidator.java	2 May 2002 22:25:44 -0000	1.4
  +++ XPathValidator.java	5 May 2002 06:59:49 -0000	1.5
  @@ -57,9 +57,10 @@
   
   package org.apache.commons.latka.validators;
   
  +import java.io.IOException;
  +
   import org.apache.commons.latka.Validator;
   import org.apache.commons.latka.ValidationException;
  -
   import org.apache.commons.latka.http.Response;
   
   import org.jdom.Document;
  @@ -112,7 +113,7 @@
    * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
    * @author dIon Gillard
    * @since 6 January, 2001
  - * @version $Id: XPathValidator.java,v 1.4 2002/05/02 22:25:44 morgand Exp $
  + * @version $Id: XPathValidator.java,v 1.5 2002/05/05 06:59:49 dion Exp $
    */
   public class XPathValidator extends BaseConditionalValidator {
   
  @@ -298,8 +299,12 @@
           SAXBuilder builder = new SAXBuilder();
           try {
               doc = builder.build(response.getStream());
  -        } catch (JDOMException e) {
  -            fail(e.toString());
  +        } catch (Exception e) {
  +            if (e instanceof IOException || e instanceof JDOMException) {
  +                fail(e.toString());
  +            } else {
  +                fail("Unknown exception caught: " + e.toString());
  +            }
           }
           if (doc == null) { // this should never happen
               fail("Null document");
  
  
  

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


Mime
View raw message