classpathx-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Classpathx-discuss] [GNUJAXP-PATCH] javax.xml.parsers.SAXParser#parse(.


From: Arnaud Vandyck
Subject: [Classpathx-discuss] [GNUJAXP-PATCH] javax.xml.parsers.SAXParser#parse(...)
Date: Fri, 15 Aug 2003 22:53:07 +0200 (CEST)

parse(...) throws IllegalArgumentException if the argument is 
null.

Attached is cvs diff -u SAXParser.java

Best Regards,

-- Arnaud Vandyck, STE fi, ULg
   Formateur Cellule Programmation.
Index: SAXParser.java
===================================================================
RCS file: /cvsroot/classpathx/jaxp/source/javax/xml/parsers/SAXParser.java,v
retrieving revision 1.4
diff -u -r1.4 SAXParser.java
--- SAXParser.java      5 Dec 2001 23:16:55 -0000       1.4
+++ SAXParser.java      15 Aug 2003 20:27:05 -0000
@@ -71,6 +71,7 @@
         * Avoid using this API, since relative URIs in the document need
         * to be resolved against the document entity's URI, and good
         * diagnostics also need that URI.
+   * @exception IllegalArgumentException if InputStream is null
         */
        public void parse(InputStream stream, HandlerBase handler) 
        throws SAXException, IOException
@@ -79,6 +80,7 @@
        /**
         * Parse using (deprecated) SAX1 style handlers,
         * and a byte stream with a specified URI.
+   * @exception IllegalArgumentException if InputStream is null
         */
        public void parse (
                InputStream stream,
@@ -86,6 +88,10 @@
                String systemID
        ) throws SAXException, IOException
        {
+    if(stream==null)
+      {
+        throw new IllegalArgumentException("InputStream is 'null'");
+      }
                InputSource     source;
 
                // Prepare Source
@@ -102,14 +108,22 @@
         * Avoid using this API, since relative URIs in the document need
         * to be resolved against the document entity's URI, and good
         * diagnostics also need that URI.
+   * @exception IllegalArgumentException if InputStream is null
         */
        public void parse(InputStream stream, DefaultHandler def) 
        throws SAXException, IOException
-           { parse (new InputSource (stream), def); }
+  {
+    if(stream==null)
+      {
+        throw new IllegalArgumentException("InputStream is 'null'");
+      }
+    parse (new InputSource (stream), def);
+  }
 
        /**
         * Parse using SAX2 style handlers,
         * and a byte stream with a specified URI.
+   * @exception IllegalArgumentException if InputStream is null
         */
        public void parse (
                InputStream stream,
@@ -117,6 +131,10 @@
                String systemID
        ) throws SAXException, IOException
        {
+    if(stream==null)
+      {
+        throw new IllegalArgumentException("InputStream is 'null'");
+      }
                InputSource     source;
 
                // Prepare Source
@@ -130,26 +148,45 @@
        /**
         * Parse using (deprecated) SAX1 style handlers,
         * and a URI for the document entity.
+   * @exception IllegalArgumentException if URI is null
         */
        public void parse(String uri, HandlerBase handler) 
        throws SAXException, IOException
-           { parse (new InputSource (uri), handler); }
+  {
+    if(uri==null)
+      {
+        throw new IllegalArgumentException("URI is 'null'");
+      }
+    parse (new InputSource (uri), handler);
+  }
 
        /**
         * Parse using SAX2 style handlers,
         * and a URI for the document entity.
+   * @exception IllegalArgumentException if URI is null
         */
        public void parse(String uri, DefaultHandler def) 
        throws SAXException, IOException
-           { parse (new InputSource (uri), def); }
+  {
+    if(uri==null)
+      {
+        throw new IllegalArgumentException("URI is 'null'");
+      }
+    parse (new InputSource (uri), def);
+  }
 
        /**
         * Parse using (deprecated) SAX1 style handlers,
         * turning a file name into the document URI.
+   * @exception IllegalArgumentException if file is null
         */
        public void parse(File file, HandlerBase handler) 
        throws SAXException, IOException
        {
+    if(file==null)
+      {
+        throw new IllegalArgumentException("The file is 'null'");
+      }
                InputSource     in;
                
                in = new InputSource (DocumentBuilder.fileToURL (file));
@@ -159,10 +196,15 @@
        /**
         * Parse using SAX2 style handlers,
         * turning a file name into the document URI.
+   * @exception IllegalArgumentException if file is null
         */
        public void parse(File file, DefaultHandler def) 
        throws SAXException, IOException
        {
+    if(file==null)
+      {
+        throw new IllegalArgumentException("The file is 'null'");
+      }
                InputSource     in;
                
                in = new InputSource (DocumentBuilder.fileToURL (file));
@@ -171,10 +213,15 @@
 
        /**
         * Parse using (deprecated) SAX1 style handlers.
+   * @exception IllegalArgumentException if InputSource is null
         */
        public void parse(InputSource source, HandlerBase handler) 
        throws SAXException, IOException
        {
+    if(source==null)
+      {
+        throw new IllegalArgumentException("The InputSource is 'null'");
+      }
                Parser  parser;
 
                // Prepare Parser
@@ -191,10 +238,15 @@
 
        /**
         * Parse using SAX2 style handlers.
+   * @exception IllegalArgumentException if InputSource is null
         */
        public void parse(InputSource source, DefaultHandler def) 
        throws SAXException, IOException
        {
+    if(source==null)
+      {
+        throw new IllegalArgumentException("The InputSource is 'null'");
+      }
                XMLReader       reader;
 
                // Prepare XML Reader
@@ -217,6 +269,7 @@
 
        /**
         * Get a SAX2 driver for the underlying parser.
+   * @since 1.1
         */
        public abstract XMLReader getXMLReader() throws SAXException;
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]