On 6/27/06, James M Snell <[EMAIL PROTECTED]> wrote:
Garrett Rooney wrote:
>[snip]
> That kind of error tends to result from passing a null stream to
> parse(). When you say that the path to simple.xml was "valid", do you
> mean you gave it a full system path, like:
>
Yep. I've seen this on several occasions and it always happens on a null
stream. We need to add some error checking on that
How about this?
-garrett
[[[
Check for null input streams in the parse() method.
[ in parser/src/main/java/org/apache/abdera/parser/stax ]
* FOMParser.java
(parse): Throw an IllegalArgumentException if we are passed a null
InputStream or Reader.
]]]
Index: parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
===================================================================
--- parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
(revision 417623)
+++ parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
(working copy)
@@ -65,6 +65,10 @@
ParserOptions options)
throws ParseException {
Document<T> document = null;
+
+ if (in == null)
+ throw new IllegalArgumentException("InputStream must not be null");
+
try {
FOMFactory factory = getFomFactory(options);
FOMBuilder builder = new FOMBuilder(factory, in, options);
@@ -83,6 +87,10 @@
ParserOptions options)
throws ParseException {
Document<T> document = null;
+
+ if (in == null)
+ throw new IllegalArgumentException("Reader must not be null");
+
try {
FOMFactory factory = getFomFactory(options);
XMLStreamReader xmlreader =