changeset 254:6cf9560bd249

Bugfix: do not write empty xml documents into database any longer - caused exceptions while serialization/deserialization. artifacts/trunk@1752 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 27 Apr 2011 16:57:20 +0000
parents a2df2b48d2aa
children efbad8c5c0e5
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 26 07:43:40 2011 +0000
+++ b/ChangeLog	Wed Apr 27 16:57:20 2011 +0000
@@ -1,3 +1,10 @@
+2011-04-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java:
+	  Bugfix: Do not create empty XML documents and save those into database -
+	  exceptions while serialization/deserialization have been the result of
+	  this.
+
 2011-04-26  Ingo Weinzierl <ingo@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java,
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Tue Apr 26 07:43:40 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Wed Apr 27 16:57:20 2011 +0000
@@ -1171,7 +1171,7 @@
 
         logger.debug("Create new collection with name: " + name);
 
-        Document attr = XMLUtils.newDocument();
+        Document attr = null;
 
         Node attrNode = (Node) XMLUtils.xpath(
             data,
@@ -1180,6 +1180,7 @@
             ArtifactNamespaceContext.INSTANCE);
 
         if (attrNode != null) {
+            attr = XMLUtils.newDocument();
             attr.appendChild(attr.importNode(attrNode, true));
         }
 
@@ -1285,7 +1286,7 @@
     {
         logger.debug("Set the attribute for the collection: " + collectionId);
 
-        Document attributes = XMLUtils.newDocument();
+        Document attributes = null;
 
         Node attr = (Node) XMLUtils.xpath(
             attribute,
@@ -1294,6 +1295,7 @@
             ArtifactNamespaceContext.INSTANCE);
 
         if (attr != null) {
+            attributes = XMLUtils.newDocument();
             attributes.appendChild(attributes.importNode(attr, true));
         }
 
@@ -1329,7 +1331,7 @@
     {
         logger.debug("Set the attribute for the artifact: " + artifactId);
 
-        Document attribute = XMLUtils.newDocument();
+        Document attribute = null;
 
         Node attr = (Node) XMLUtils.xpath(
             source,
@@ -1338,6 +1340,7 @@
             ArtifactNamespaceContext.INSTANCE);
 
         if (attr != null) {
+            attribute = XMLUtils.newDocument();
             attribute.appendChild(attribute.importNode(attr, true));
         }
 

http://dive4elements.wald.intevation.org