[jdom-interest] ValidityException

Bradley S. Huffman hip at csa.cs.okstate.edu
Sun Jun 1 20:06:45 PDT 2003


Elliotte Rusty Harold writes:

> Be careful when applying these. I had some trouble syncing my tree to 
> the latest CVS. I think it's all there now, but do a sanity check first.

Needed to compensate for new BuilderErrorHandler constructor in a couple of
the adapters in org.jdom.adapters.

Brad

? patch
? new
? src/java/org/jdom/input/SAXValidityException.java
? src/java/org/jdom/input/ValidityException.java
Index: src/java/org/jdom/Document.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/Document.java,v
retrieving revision 1.71
diff -r1.71 Document.java
131c131
<      * @throws IllegalAddException if the given docType object
---
>      * @throws IllegalAddException if the given DocType object
578,580c578,580
<      * @param ob <code>Object</code> to compare to.
<      * @return <code>boolean</code> - whether the <code>Document</code> is
<      *         equal to the supplied <code>Object</code>.
---
>      * @param ob <code>Object</code> to compare to
>      * @return <code>boolean</code> whether the <code>Document</code> is
>      *         equal to the supplied <code>Object</code>
589c589
<      * @return <code>int</code> - hash code.
---
>      * @return <code>int</code> hash code
598c598
<      * @return <code>Object</code> - clone of this <code>Document</code>.
---
>      * @return <code>Object</code> clone of this <code>Document</code>
Index: src/java/org/jdom/Verifier.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/Verifier.java,v
retrieving revision 1.47
diff -r1.47 Verifier.java
611c611
<      *
---
>      * 
633,634c633
<                        if (!isHexDigit(firstDigit) ||
<                            !isHexDigit(secondDigit)) {
---
>                        if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit)) {
636c635
<                             + "exactly two hexadecimal digits.";
---
>                             + "exactly two hexadecimal digits.";    
638c637
< 
---
>           
642c641
<                         + "exactly two hexadecimal digits.";
---
>                         + "exactly two hexadecimal digits.";    
712c711
< 
---
>     
718c717
<      * @param c <code>char</code> to check for XML compliance.
---
>      * @param c <code>char</code> to check for XML compliance
720c719
<      *                                false otherwise.
---
>      *                                false otherwise
1177,1178c1176,1177
<      * @param c <code>char</code> to check for XML digit compliance.
<      * @return <code>boolean</code> true if it's a digit, false otherwise.
---
>      * @param c <code>char</code> to check for XML digit compliance
>      * @return <code>boolean</code> true if it's a digit, false otherwise
Index: src/java/org/jdom/adapters/JAXPDOMAdapter.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/adapters/JAXPDOMAdapter.java,v
retrieving revision 1.11
diff -r1.11 JAXPDOMAdapter.java
131c131
<                                  new Object[]{new BuilderErrorHandler()});
---
>                                  new Object[]{new BuilderErrorHandler(validate)});
Index: src/java/org/jdom/adapters/XML4JDOMAdapter.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/adapters/XML4JDOMAdapter.java,v
retrieving revision 1.16
diff -r1.16 XML4JDOMAdapter.java
120c120
<                 setErrorHandler.invoke(parser, new Object[] {new BuilderErrorHandler()});
---
>                 setErrorHandler.invoke(parser, new Object[] {new BuilderErrorHandler(validate)});
Index: src/java/org/jdom/adapters/XercesDOMAdapter.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/adapters/XercesDOMAdapter.java,v
retrieving revision 1.17
diff -r1.17 XercesDOMAdapter.java
119c119
<                     new Object[] {new BuilderErrorHandler()});
---
>                     new Object[] {new BuilderErrorHandler(validate)});
Index: src/java/org/jdom/input/BuilderErrorHandler.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/input/BuilderErrorHandler.java,v
retrieving revision 1.11
diff -r1.11 BuilderErrorHandler.java
72a73,78
>     private boolean validating;  
>       
>     public BuilderErrorHandler(boolean reportValidityErrors) {
>         this.validating = reportValidityErrors;
>     }
>      
96c102,107
<         throw exception;
---
>         if (validating) {
>             throw new SAXValidityException(exception.getMessage(), 
>               exception.getPublicId(), exception.getSystemId(),
>               exception.getLineNumber(), exception.getColumnNumber());
>         }
>         else throw exception;
Index: src/java/org/jdom/input/SAXBuilder.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/input/SAXBuilder.java,v
retrieving revision 1.78
diff -r1.78 SAXBuilder.java
410,412c410,412
<      * @param in <code>InputSource</code> to read from.
<      * @return <code>Document</code> - resultant Document object.
<      * @throws JDOMException when errors occur in parsing.
---
>      * @param in <code>InputSource</code> to read from
>      * @return <code>Document</code> resultant Document object
>      * @throws JDOMException when errors occur in parsing
414c414
<      *         from being fully parsed.
---
>      *         from being fully parsed
451c451
<                 // Reset content handler as SAXHandler instances can not
---
>                 // Reset content handler as SAXHandler instances cannot
460a461,472
>         catch (SAXValidityException e) {
>             String systemId = e.getSystemId();
>             if (systemId != null) {
>                 throw new ValidityException("Validity error on line " + 
>                     e.getLineNumber() + " of document " + systemId,
>                     e, contentHandler.getDocument());
>             } else {
>                 throw new ValidityException("Validity error on line " +
>                     e.getLineNumber(), e,
>                     contentHandler.getDocument());
>             }
>         }
621c633
<              parser.setErrorHandler(new BuilderErrorHandler());
---
>              parser.setErrorHandler(new BuilderErrorHandler(validate));
763,765c775,779
<      * @param in <code>InputStream</code> to read from.
<      * @return <code>Document</code> - resultant Document object.
<      * @throws JDOMException when errors occur in parsing.
---
>      * @param in <code>InputStream</code> to read from
>      * @return <code>Document</code> resultant Document object
>      * @throws JDOMException when errors occur in parsing
>      * @throws ValidityException when the document is invalid and this 
>      *         builder has been configured to validate
780,782c794,798
<      * @param file <code>File</code> to read from.
<      * @return <code>Document</code> - resultant Document object.
<      * @throws JDOMException when errors occur in parsing.
---
>      * @param file <code>File</code> to read from
>      * @return <code>Document</code> resultant Document object
>      * @throws JDOMException when errors occur in parsing
>      * @throws ValidityException when the document is invalid and this 
>      *     builder has been configured to validate
784c800
<      *         from being fully parsed.
---
>      *         from being fully parsed
804c820,822
<      * @throws JDOMException when errors occur in parsing.
---
>      * @throws JDOMException when errors occur in parsing
>      * @throws ValidityException when the document is invalid and this 
>      *     builder has been configured to validate
822,823c840,843
<      * @return <code>Document</code> - resultant Document object.
<      * @throws JDOMException when errors occur in parsing.
---
>      * @return <code>Document</code> resultant Document object
>      * @throws JDOMException when errors occur in parsing
>      * @throws ValidityException when the document is invalid and this 
>      *     builder has been configured to validate
825c845
<      *         from being fully parsed.
---
>      *         from being fully parsed
843,845c863,867
<      * @param characterStream <code>Reader</code> to read from.
<      * @return <code>Document</code> - resultant Document object.
<      * @throws JDOMException when errors occur in parsing.
---
>      * @param characterStream <code>Reader</code> to read from
>      * @return <code>Document</code> resultant Document object
>      * @throws JDOMException when errors occur in parsing
>      * @throws ValidityException when the document is invalid and this 
>      *     builder has been configured to validate
847c869
<      *         from being fully parsed.
---
>      *         from being fully parsed
864,865c886,889
<      * @return <code>Document</code> - resultant Document object.
<      * @throws JDOMException when errors occur in parsing.
---
>      * @return <code>Document</code> resultant Document object
>      * @throws JDOMException when errors occur in parsing
>      * @throws ValidityException when the document is invalid and this 
>      *     builder has been configured to validate
867c891
<      *         from being fully parsed.
---
>      *         from being fully parsed
883,884c907,910
<      * @return <code>Document</code> - resultant Document object.
<      * @throws JDOMException when errors occur in parsing.
---
>      * @return <code>Document</code> resultant Document object
>      * @throws JDOMException when errors occur in parsing
>      * @throws ValidityException when the document is invalid and this 
>      *     builder has been configured to validate
886c912
<      *         from being fully parsed.
---
>      *         from being fully parsed



More information about the jdom-interest mailing list