You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jw...@apache.org on 2005/05/12 14:54:56 UTC

svn commit: r169810 - /lenya/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java

Author: jwkaltz
Date: Thu May 12 05:54:56 2005
New Revision: 169810

URL: http://svn.apache.org/viewcvs?rev=169810&view=rev
Log:
[minor change] check for null parameter

Modified:
    lenya/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java

Modified: lenya/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java?rev=169810&r1=169809&r2=169810&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java Thu May 12 05:54:56 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright  1999-2004 The Apache Software Foundation
+ * Copyright  1999-2005 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
  *
  */
 
-/* $Id$  */
-
 package org.apache.lenya.xml;
 
 import java.io.File;
@@ -51,6 +49,7 @@
 
 /**
  * Various utility methods to work with JAXP.
+ * @version $Id$
  */
 public class DocumentHelper {
     /**
@@ -184,6 +183,12 @@
      */
     public static void writeDocument(Document document, File file)
             throws TransformerConfigurationException, TransformerException, IOException {
+        // sanity checks
+        if (document == null)
+            throw new IllegalArgumentException("parameter document may not be null");
+        if (file == null)
+            throw new IllegalArgumentException("parameter file may not be null");
+
         file.getParentFile().mkdirs();
         file.createNewFile();
 
@@ -431,4 +436,4 @@
 
         return (Element[]) childElements.toArray(new Element[childElements.size()]);
     }
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org