You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ve...@apache.org on 2003/11/18 21:10:38 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/parsers DOMParserImpl.java AbstractDOMParser.java
venu 2003/11/18 12:10:38
Modified: java/src/org/apache/xerces/parsers DOMParserImpl.java
AbstractDOMParser.java
Log:
Patches for bugs #24795 ,#24797: Patches submitted by ramesh mandava.
Revision Changes Path
1.7 +34 -5 xml-xerces/java/src/org/apache/xerces/parsers/DOMParserImpl.java
Index: DOMParserImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParserImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DOMParserImpl.java 17 Nov 2003 13:48:41 -0000 1.6
+++ DOMParserImpl.java 18 Nov 2003 20:10:38 -0000 1.7
@@ -722,8 +722,17 @@
*
*/
public Document parseURI(String uri) {
- XMLInputSource source = new XMLInputSource(null, uri, null);
+ //If DOMParser insstance is already busy parsing another document when this
+ // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
+ if ( fBusy ) {
+ String msg = DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "INVALID_STATE_ERR",null);
+ throw new DOMException( DOMException.INVALID_STATE_ERR,msg);
+ }
+
+ XMLInputSource source = new XMLInputSource(null, uri, null);
fBusy = true;
try {
parse(source);
@@ -754,8 +763,15 @@
// need to wrap the LSInput with an XMLInputSource
XMLInputSource xmlInputSource = dom2xmlInputSource(is);
fBusy = true;
-
- try {
+
+ if ( fBusy ) {
+ String msg = DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "INVALID_STATE_ERR",null);
+ throw new DOMException( DOMException.INVALID_STATE_ERR,msg);
+ }
+
+ try {
parse(xmlInputSource);
fBusy = false;
} catch (Exception e) {
@@ -851,6 +867,19 @@
*/
public boolean getBusy() {
return fBusy;
- }
+ }
+
+ /**
+ * @see org.w3c.dom.ls.DOMParser#abort()
+ */
+ public void abort() {
+ // If parse operation is in progress then reset it
+ if ( fBusy ) {
+ //Revisit :: Just reset in not sufficient.
+ reset();
+ fBusy = false;
+ }
+ return; // If not busy then this is noop
+ }
} // class DOMParserImpl
1.99 +3 -2 xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
Index: AbstractDOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- AbstractDOMParser.java 17 Nov 2003 13:48:41 -0000 1.98
+++ AbstractDOMParser.java 18 Nov 2003 20:10:38 -0000 1.99
@@ -2534,7 +2534,8 @@
}
if (fDOMFilter !=null) {
- if ((fDOMFilter.getWhatToShow() & NodeFilter.SHOW_TEXT)!= 0) {
+ if ( (child.getNodeType() == Node.TEXT_NODE ) &&
+ ((fDOMFilter.getWhatToShow() & NodeFilter.SHOW_TEXT)!= 0) ) {
short code = fDOMFilter.acceptNode(child);
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org