xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrgla...@apache.org
Subject svn commit: r696457 - /xerces/java/trunk/src/org/apache/xerces/util/StAXInputSource.java
Date Wed, 17 Sep 2008 21:26:53 GMT
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


Mime
View raw message