nddelima 2004/08/26 14:28:40 Modified: java/src/org/apache/xerces/dom NotationImpl.java CoreDocumentImpl.java EntityImpl.java ProcessingInstructionImpl.java EntityReferenceImpl.java Log: Fix for defect http://nagoya.apache.org/jira/browse/XERCESJ-864 so that Node.getBaseURI consistently returns null if the URI to return is malformed. Revision Changes Path 1.18 +17 -3 xml-xerces/java/src/org/apache/xerces/dom/NotationImpl.java Index: NotationImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/NotationImpl.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- NotationImpl.java 24 Feb 2004 23:23:18 -0000 1.17 +++ NotationImpl.java 26 Aug 2004 21:28:39 -0000 1.18 @@ -16,6 +16,7 @@ package org.apache.xerces.dom; +import org.apache.xerces.util.URI; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.Notation; @@ -172,12 +173,25 @@ /** - * DOM Level 3 WD - Experimental. - * Retrieve baseURI + * Returns the absolute base URI of this node or null if the implementation + * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a + * null is returned. + * + * @return The absolute base URI of this node or null. + * @since DOM Level 3 */ public String getBaseURI() { if (needsSyncData()) { synchronizeData(); + } + if (baseURI != null && baseURI.length() != 0 ) {// attribute value is always empty string + try { + baseURI = new URI(baseURI).toString(); + } + catch (org.apache.xerces.util.URI.MalformedURIException e){ + // REVISIT: what should happen in this case? + return null; + } } return baseURI; } 1.78 +17 -3 xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java Index: CoreDocumentImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v retrieving revision 1.77 retrieving revision 1.78 diff -u -r1.77 -r1.78 --- CoreDocumentImpl.java 23 Aug 2004 01:28:41 -0000 1.77 +++ CoreDocumentImpl.java 26 Aug 2004 21:28:39 -0000 1.78 @@ -19,6 +19,7 @@ import java.lang.reflect.Constructor; import java.util.Enumeration; import java.util.Hashtable; +import org.apache.xerces.util.URI; import org.apache.xerces.dom3.DOMConfiguration; import org.apache.xerces.dom3.UserDataHandler; @@ -1164,10 +1165,23 @@ /** - * DOM Level 3 WD - Experimental. - * Retrieve baseURI + * Returns the absolute base URI of this node or null if the implementation + * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a + * null is returned. + * + * @return The absolute base URI of this node or null. + * @since DOM Level 3 */ public String getBaseURI() { + if (fDocumentURI != null && fDocumentURI.length() != 0 ) {// attribute value is always empty string + try { + fDocumentURI = new URI(fDocumentURI).toString(); + } + catch (org.apache.xerces.util.URI.MalformedURIException e){ + // REVISIT: what should happen in this case? + return null; + } + } return fDocumentURI; } 1.25 +7 -3 xml-xerces/java/src/org/apache/xerces/dom/EntityImpl.java Index: EntityImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/EntityImpl.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- EntityImpl.java 24 Feb 2004 23:23:18 -0000 1.24 +++ EntityImpl.java 26 Aug 2004 21:28:39 -0000 1.25 @@ -309,8 +309,12 @@ /** - * DOM Level 3 WD - Experimental. - * Retrieve baseURI + * Returns the absolute base URI of this node or null if the implementation + * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a + * null is returned. + * + * @return The absolute base URI of this node or null. + * @since DOM Level 3 */ public String getBaseURI() { 1.14 +7 -3 xml-xerces/java/src/org/apache/xerces/dom/ProcessingInstructionImpl.java Index: ProcessingInstructionImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ProcessingInstructionImpl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ProcessingInstructionImpl.java 24 Feb 2004 23:23:17 -0000 1.13 +++ ProcessingInstructionImpl.java 26 Aug 2004 21:28:39 -0000 1.14 @@ -137,8 +137,12 @@ /** - * DOM Level 3 WD - Experimental. - * Retrieve baseURI + * Returns the absolute base URI of this node or null if the implementation + * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a + * null is returned. + * + * @return The absolute base URI of this node or null. + * @since DOM Level 3 */ public String getBaseURI() { 1.25 +17 -4 xml-xerces/java/src/org/apache/xerces/dom/EntityReferenceImpl.java Index: EntityReferenceImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/EntityReferenceImpl.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- EntityReferenceImpl.java 24 Feb 2004 23:23:18 -0000 1.24 +++ EntityReferenceImpl.java 26 Aug 2004 21:28:39 -0000 1.25 @@ -16,6 +16,7 @@ package org.apache.xerces.dom; +import org.apache.xerces.util.URI; import org.w3c.dom.DocumentType; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; @@ -145,8 +146,12 @@ } /** - * DOM Level 3 WD - Experimental. - * Retrieve baseURI + * Returns the absolute base URI of this node or null if the implementation + * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a + * null is returned. + * + * @return The absolute base URI of this node or null. + * @since DOM Level 3 */ public String getBaseURI() { if (needsSyncData()) { @@ -164,7 +169,15 @@ return entDef.getBaseURI(); } } - } + } else if (baseURI != null && baseURI.length() != 0 ) {// attribute value is always empty string + try { + baseURI = new URI(baseURI).toString(); + } + catch (org.apache.xerces.util.URI.MalformedURIException e){ + // REVISIT: what should happen in this case? + return null; + } + } return baseURI; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]