Author: vgritsenko
Date: Wed Oct 27 18:18:35 2004
New Revision: 55760

Modified:
   
cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
   cocoon/trunk/status.xml
Log:
Bug 30849: NPE in XMLDBTransformer


Modified: 
cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
==============================================================================
--- 
cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
   (original)
+++ 
cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
   Wed Oct 27 18:18:35 2004
@@ -416,7 +416,10 @@
                     // Obtain collection for the current operation
                     collection = (xbase != null)? 
DatabaseManager.getCollection(local_base + "/" + xbase) : this.collection;
 
-                    if ("create".equals(operation)) {
+                    if (collection == null) {
+                        message = "Failed to " + operation + " resource " + 
this.key + ": Collection " + local_base + "/" + xbase + " not found.";
+                        getLogger().debug(message);
+                    } else if ("create".equals(operation)) {
                         if (key != null && key.endsWith("/")) {
                             try {
                                 // Cut trailing '/'
@@ -490,7 +493,7 @@
                     message = "Failed to get context collection for the query 
(base: " + local_base + ", context: " + xbase + "): " + e.errorCode;
                     getLogger().debug(message, e);
                 } finally {
-                    if (xbase != null) {
+                    if (xbase != null && collection != null) {
                         try {
                             collection.close();
                         } catch (XMLDBException ignored) {

Modified: cocoon/trunk/status.xml
==============================================================================
--- cocoon/trunk/status.xml     (original)
+++ cocoon/trunk/status.xml     Wed Oct 27 18:18:35 2004
@@ -322,6 +322,10 @@
    </action>
  </release>
  <release version="2.1.6" date="TBD">
+   <action dev="VG" type="fix" fixes-bug="30849">
+     XMLDB Block: Fix NullPointerException in XMLDBTransformer if specified
+     collection does not exist.
+   </action>
    <action dev="AG" type="fix" fixes-bug="31564" due-to="Gunnar Brand" 
due-to-email="[EMAIL PROTECTED]">
      XSP - JXPath logicsheet: Allow use relative contexts in 
&lt;jxpath:for-each&gt;.
            Add a new tag &lt;jpath:set-lenient lenient="true|false"&gt;

Reply via email to