Update of /var/cvs/src/org/mmbase/bridge/util/xml
In directory james.mmbase.org:/tmp/cvs-serv19466

Modified Files:
        Generator.java 
Log Message:
made documentBuilder final, because it is only set in the contructor. Throws 
IllegalArgumentException if it is set to null, because that would certainly 
give NPE later on otherwise


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/bridge/util/xml


Index: Generator.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/xml/Generator.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- Generator.java      9 Apr 2007 19:10:27 -0000       1.48
+++ Generator.java      1 Apr 2009 14:01:22 -0000       1.49
@@ -24,7 +24,7 @@
  *
  * @author Michiel Meeuwissen
  * @author Eduard Witteveen
- * @version $Id: Generator.java,v 1.48 2007/04/09 19:10:27 michiel Exp $
+ * @version $Id: Generator.java,v 1.49 2009/04/01 14:01:22 michiel Exp $
  * @since  MMBase-1.6
  */
 public class Generator {
@@ -36,7 +36,7 @@
     private final static String DOCUMENTTYPE_SYSTEM = 
"http://www.mmbase.org/dtd/objects_1_0.dtd";;
 
     private Document document = null;
-    private DocumentBuilder documentBuilder = null;
+    private final DocumentBuilder documentBuilder;
     private Cloud cloud = null;
 
     private boolean namespaceAware = false;
@@ -54,6 +54,7 @@
      * @see   org.mmbase.util.xml.DocumentReader#getDocumentBuilder()
      */
     public Generator(DocumentBuilder documentBuilder, Cloud cloud) {
+        if (documentBuilder == null) throw new IllegalArgumentException();
         this.documentBuilder = documentBuilder;
         this.cloud = cloud;
 
@@ -64,7 +65,9 @@
     }
 
     public Generator(Document doc) {
+        if (doc == null) throw new IllegalArgumentException();
         document = doc;
+        documentBuilder = null;
         namespaceAware = document.getDocumentElement().getNamespaceURI() != 
null;
     }
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to