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 2008/09/17 23:26:53 UTC

svn commit: r696457 - /xerces/java/trunk/src/org/apache/xerces/util/StAXInputSource.java

Author: mrglavas
Date: Wed Sep 17 14:26:53 2008
New Revision: 696457

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

Modified:
    xerces/java/trunk/src/org/apache/xerces/util/StAXInputSource.java

Modified: xerces/java/trunk/src/org/apache/xerces/util/StAXInputSource.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/util/StAXInputSource.java?rev=696457&r1=696456&r2=696457&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/util/StAXInputSource.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/util/StAXInputSource.java Wed Sep 17 14:26:53 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