[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Classpathx-discuss] [GNUJAXP-PATCH] javax.xml.parsers.DocumentBuilder#p
From: |
Arnaud Vandyck |
Subject: |
[Classpathx-discuss] [GNUJAXP-PATCH] javax.xml.parsers.DocumentBuilder#parse(...) |
Date: |
Fri, 15 Aug 2003 22:51:37 +0200 (CEST) |
parse([*]) throws IllegalArgumentException if the argument is
null. [*]File, InputSource, InputStream, InputStream, String
Attached is cvs diff -u DocumentBuilder.java
Best Regards,
-- Arnaud Vandyck, STE fi, ULg
Formateur Cellule Programmation.
Index: DocumentBuilder.java
===================================================================
RCS file:
/cvsroot/classpathx/jaxp/source/javax/xml/parsers/DocumentBuilder.java,v
retrieving revision 1.8
diff -u -r1.8 DocumentBuilder.java
--- DocumentBuilder.java 8 Feb 2002 18:51:10 -0000 1.8
+++ DocumentBuilder.java 15 Aug 2003 20:23:05 -0000
@@ -96,17 +96,30 @@
/**
* Constructs an InputSource from the file, and invokes parse ().
* The InputSource includes the URI for the file.
+ * @param file the file to parse
+ * @return the DOM representation of the xml document
+ * @exception IOException
+ * @exception SAXException if parse errors occur
+ * @exception IllegalArgumentException if the file is null
*/
public Document parse (File file)
throws SAXException, IOException
{
- InputSource source;
-
- source = new InputSource (fileToURL (file));
- source.setByteStream (new FileInputStream(file));
- return parse (source);
+ if (file==null)
+ {
+ throw new IllegalArgumentException("File si 'null'");
+ }
+ InputSource source;
+
+ source = new InputSource (fileToURL (file));
+ source.setByteStream (new FileInputStream(file));
+ return parse (source);
}
-
+
+ /**
+ *
+ * @exception IllegalArgumentException if InputSource is null
+ */
public abstract Document parse(InputSource source)
throws SAXException, IOException;
@@ -114,15 +127,28 @@
* Avoid using this call; provide the system ID wherever possible.
* System IDs are essential when parsers resolve relative URIs,
* or provide diagnostics.
+ * @exception IllegalArgumentException if InputStream is null
*/
public Document parse(InputStream stream)
throws SAXException, IOException {
+ if (stream==null)
+ {
+ throw new IllegalArgumentException("InputStream si 'null'");
+ }
return parse(new InputSource(stream));
} // parse()
+ /**
+ *
+ * @exception IllegalArgumentException if InputStream is null
+ */
public Document parse(InputStream stream, String systemID)
throws SAXException, IOException {
+ if (stream==null)
+ {
+ throw new IllegalArgumentException("InputStream si 'null'");
+ }
// Variables
InputSource source;
@@ -135,11 +161,19 @@
} // parse()
+ /**
+ *
+ * @exception IllegalArgumentException if the URI is null
+ */
public Document parse(String uri)
throws SAXException, IOException {
+ if (uri==null)
+ {
+ throw new IllegalArgumentException("URI si 'null'");
+ }
return parse(new InputSource(uri));
} // parse()
-
+
public abstract void setEntityResolver(EntityResolver resolver);
public abstract void setErrorHandler(ErrorHandler handler);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Classpathx-discuss] [GNUJAXP-PATCH] javax.xml.parsers.DocumentBuilder#parse(...),
Arnaud Vandyck <=