changeset 1175:e6b513495281

Prepared FLYSArtifactCollection to live without Artifacts. flys-artifacts/trunk@2760 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 15 Sep 2011 15:00:23 +0000
parents f58be0d661b9
children 28154920e0b3
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java
diffstat 2 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Sep 15 14:58:36 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Sep 15 15:00:23 2011 +0000
@@ -1,3 +1,8 @@
+2011-09-15  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java:
+	  Made collection solid for the case if it has no Artifacts.
+
 2011-09-15  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/utils/FLYSUtils.java: Fetch Artifact
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Thu Sep 15 14:58:36 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Thu Sep 15 15:00:23 2011 +0000
@@ -99,13 +99,15 @@
 
             collection.appendChild(doc.importNode(newAttr, true));
 
-            for (String uuid: aUUIDs) {
-                try {
-                    artifacts.appendChild(
-                        buildArtifactNode(db, uuid, context, ec));
-                }
-                catch (ArtifactDatabaseException dbe) {
-                    log.warn(dbe, dbe);
+            if (aUUIDs != null) {
+                for (String uuid: aUUIDs) {
+                    try {
+                        artifacts.appendChild(
+                            buildArtifactNode(db, uuid, context, ec));
+                    }
+                    catch (ArtifactDatabaseException dbe) {
+                        log.warn(dbe, dbe);
+                    }
                 }
             }
         }
@@ -313,12 +315,14 @@
         AttributeParser aParser = new AttributeParser();
         OutputParser    oParser = new OutputParser(db, context);
 
-        for (String uuid: items) {
-            try {
-                oParser.parse(uuid);
-            }
-            catch (ArtifactDatabaseException ade) {
-                log.warn(ade, ade);
+        if (items != null) {
+            for (String uuid: items) {
+                try {
+                    oParser.parse(uuid);
+                }
+                catch (ArtifactDatabaseException ade) {
+                    log.warn(ade, ade);
+                }
             }
         }
 

http://dive4elements.wald.intevation.org