# HG changeset patch # User Ingo Weinzierl # Date 1299229998 0 # Node ID f70977cf2faf1531fd27727118241c023f73d21a # Parent c9c27aca2f706307eda419e9c857ed5fc2ed9154 Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned. artifacts/trunk@1393 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r c9c27aca2f70 -r f70977cf2faf ChangeLog --- a/ChangeLog Thu Mar 03 17:01:04 2011 +0000 +++ b/ChangeLog Fri Mar 04 09:13:18 2011 +0000 @@ -1,3 +1,10 @@ +2011-03-04 Ingo Weinzierl + + * artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java: + If there is no creation time of a collection, we just add an empty + string to the collection node in listCollections(). A + NullPointerException is avoided! + 2011-03-03 Sascha L. Teichmann * artifact-database/src/main/resources/sql/org-h2-driver.properties, diff -r c9c27aca2f70 -r f70977cf2faf artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java --- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Thu Mar 03 17:01:04 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Fri Mar 04 09:13:18 2011 +0000 @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -1154,9 +1155,13 @@ Element collection = ec.create("artifact-collection"); ec.addAttr(collection, "name", c.getName()); ec.addAttr(collection, "uuid", c.identifier()); - ec.addAttr( - collection, "creation", - Long.toString(c.getCreationTime().getTime())); + + Date creationTime = c.getCreationTime(); + String creation = creationTime != null + ? Long.toString(creationTime.getTime()) + : ""; + + ec.addAttr(collection, "creation", creation); root.appendChild(collection); }