xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrgla...@apache.org
Subject svn commit: r696458 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/StAXInputSource.java
Date Wed, 17 Sep 2008 21:27:15 GMT
Author: mrglavas
Date: Wed Sep 17 14:27:15 2008
New Revision: 696458

URL: http://svn.apache.org/viewvc?rev=696458&view=rev
Log:
Disallow null values for the XMLStreamReader / XMLEventReader constructor parameters.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/StAXInputSource.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/StAXInputSource.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/StAXInputSource.java?rev=696458&r1=696457&r2=696458&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/StAXInputSource.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/StAXInputSource.java
Wed Sep 17 14:27:15 2008
@@ -40,6 +40,9 @@
     
     public StAXInputSource(XMLStreamReader source, boolean consumeRemainingContent) {
         super(null, source.getLocation().getSystemId(), null);
+        if (source == null) {
+            throw new IllegalArgumentException("XMLStreamReader parameter cannot be null.");
+        }
         fStreamReader = source;
         fEventReader = null;
         fConsumeRemainingContent = consumeRemainingContent;
@@ -51,6 +54,9 @@
     
     public StAXInputSource(XMLEventReader source, boolean consumeRemainingContent) {
         super(null, getEventReaderSystemId(source), null);
+        if (source == null) {
+            throw new IllegalArgumentException("XMLEventReader parameter cannot be null.");
+        }
         fStreamReader = null;
         fEventReader = source;
         fConsumeRemainingContent = consumeRemainingContent;
@@ -74,11 +80,12 @@
     
     private static String getEventReaderSystemId(XMLEventReader reader) {
         try {
-            return reader.peek().getLocation().getSystemId();
-        }
-        catch (XMLStreamException e) {
-            return null;
+            if (reader != null) {
+                return reader.peek().getLocation().getSystemId();
+            }
         }
+        catch (XMLStreamException e) {}
+        return null;
     }
     
 } // StAXInputSource



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org


Mime
View raw message