You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dm...@apache.org on 2002/04/11 05:00:11 UTC
cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath XMLDocumentContainer.java
dmitri 02/04/10 20:00:11
Modified: jxpath/src/java/org/apache/commons/jxpath
XMLDocumentContainer.java
Log:
NPE when file is missing is now fixed
Revision Changes Path
1.2 +11 -4 jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java
Index: XMLDocumentContainer.java
===================================================================
RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLDocumentContainer.java 3 Sep 2001 01:22:30 -0000 1.1
+++ XMLDocumentContainer.java 11 Apr 2002 03:00:11 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java,v 1.1 2001/09/03 01:22:30 dmitri Exp $
- * $Revision: 1.1 $
- * $Date: 2001/09/03 01:22:30 $
+ * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java,v 1.2 2002/04/11 03:00:11 dmitri Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/04/11 03:00:11 $
*
* ====================================================================
* The Apache Software License, Version 1.1
@@ -82,7 +82,7 @@
* read at all.
*
* @author Dmitri Plotnikov
- * @version $Revision: 1.1 $ $Date: 2001/09/03 01:22:30 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/11 03:00:11 $
*/
public class XMLDocumentContainer implements Container {
@@ -92,10 +92,16 @@
public XMLDocumentContainer(URL xmlURL){
this.xmlURL = xmlURL;
+ if (xmlURL == null){
+ throw new RuntimeException("Source is null");
+ }
}
public XMLDocumentContainer(Source source){
this.source = source;
+ if (source == null){
+ throw new RuntimeException("Source is null");
+ }
}
public Object getValue(){
@@ -120,7 +126,8 @@
}
catch (Exception ex){
throw new RuntimeException("Cannot read XML from: " +
- (xmlURL != null ? xmlURL.toString() : source.getSystemId()) + "\n" + ex);
+ (xmlURL != null ? xmlURL.toString() :
+ (source != null ? source.getSystemId() : "<<undefined source>>")) + "\n" + ex);
}
}
return document;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>