You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/11/08 06:48:28 UTC
svn commit: r331696 - in /xerces/java/trunk/src/org/apache/xerces:
impl/Constants.java impl/XMLVersionDetector.java
parsers/XML11Configuration.java parsers/XML11DTDConfiguration.java
parsers/XML11NonValidatingConfiguration.java
Author: mrglavas
Date: Mon Nov 7 21:48:24 2005
New Revision: 331696
URL: http://svn.apache.org/viewcvs?rev=331696&view=rev
Log:
Fixing a bug which caused an NPE to be thrown from the scanner
when the continue-after-fatal-error feature is enabled. If the
document being parsed is empty, the version detector reports
the error at which point we should stop parsing because there's
no input.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/Constants.java
xerces/java/trunk/src/org/apache/xerces/impl/XMLVersionDetector.java
xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java
xerces/java/trunk/src/org/apache/xerces/parsers/XML11DTDConfiguration.java
xerces/java/trunk/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/Constants.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/Constants.java?rev=331696&r1=331695&r2=331696&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/Constants.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/Constants.java Mon Nov 7 21:48:24 2005
@@ -409,6 +409,7 @@
public final static String CHAR_REF_PROBABLE_WS = "CHAR_REF_PROBABLE_WS";
// XML version constants
+ public final static short XML_VERSION_ERROR = -1;
public final static short XML_VERSION_1_0 = 1;
public final static short XML_VERSION_1_1 = 2;
Modified: xerces/java/trunk/src/org/apache/xerces/impl/XMLVersionDetector.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/XMLVersionDetector.java?rev=331696&r1=331695&r2=331696&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/XMLVersionDetector.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/XMLVersionDetector.java Mon Nov 7 21:48:24 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -181,21 +181,19 @@
if (fExpectedVersionString[15 + matched] != XML11_VERSION[matched])
break;
}
- if (matched == XML11_VERSION.length)
- return Constants.XML_VERSION_1_1;
- return Constants.XML_VERSION_1_0;
- // premature end of file
+ return (matched == XML11_VERSION.length) ?
+ Constants.XML_VERSION_1_1 :
+ Constants.XML_VERSION_1_0;
}
+ // premature end of file
catch (EOFException e) {
fErrorReporter.reportError(
XMLMessageFormatter.XML_DOMAIN,
"PrematureEOF",
null,
XMLErrorReporter.SEVERITY_FATAL_ERROR);
- return Constants.XML_VERSION_1_0;
-
+ return Constants.XML_VERSION_ERROR;
}
-
}
// This method prepends "length" chars from the char array,
Modified: xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java?rev=331696&r1=331695&r2=331696&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java Mon Nov 7 21:48:24 2005
@@ -769,13 +769,20 @@
resetCommon();
short version = fVersionDetector.determineDocVersion(fInputSource);
- if (version == Constants.XML_VERSION_1_1) {
+ // XML 1.0
+ if (version == Constants.XML_VERSION_1_0) {
+ configurePipeline();
+ reset();
+ }
+ // XML 1.1
+ else if (version == Constants.XML_VERSION_1_1) {
initXML11Components();
configureXML11Pipeline();
resetXML11();
- } else {
- configurePipeline();
- reset();
+ }
+ // Unrecoverable error reported during version detection
+ else {
+ return false;
}
// mark configuration as fixed
Modified: xerces/java/trunk/src/org/apache/xerces/parsers/XML11DTDConfiguration.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/parsers/XML11DTDConfiguration.java?rev=331696&r1=331695&r2=331696&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/XML11DTDConfiguration.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/XML11DTDConfiguration.java Mon Nov 7 21:48:24 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 The Apache Software Foundation.
+ * Copyright 2004,2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -701,13 +701,20 @@
resetCommon();
short version = fVersionDetector.determineDocVersion(fInputSource);
- if (version == Constants.XML_VERSION_1_1) {
+ // XML 1.0
+ if (version == Constants.XML_VERSION_1_0) {
+ configurePipeline();
+ reset();
+ }
+ // XML 1.1
+ else if (version == Constants.XML_VERSION_1_1) {
initXML11Components();
configureXML11Pipeline();
resetXML11();
- } else {
- configurePipeline();
- reset();
+ }
+ // Unrecoverable error reported during version detection
+ else {
+ return false;
}
// mark configuration as fixed
Modified: xerces/java/trunk/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java?rev=331696&r1=331695&r2=331696&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java Mon Nov 7 21:48:24 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 The Apache Software Foundation.
+ * Copyright 2004,2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -627,13 +627,20 @@
resetCommon();
short version = fVersionDetector.determineDocVersion(fInputSource);
- if (version == Constants.XML_VERSION_1_1) {
+ // XML 1.0
+ if (version == Constants.XML_VERSION_1_0) {
+ configurePipeline();
+ reset();
+ }
+ // XML 1.1
+ else if (version == Constants.XML_VERSION_1_1) {
initXML11Components();
configureXML11Pipeline();
resetXML11();
- } else {
- configurePipeline();
- reset();
+ }
+ // Unrecoverable error reported during version detection
+ else {
+ return false;
}
// mark configuration as fixed
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org