changeset 1016:ff7b81cf9999

Meta data service: Be a bit more tolerant about empty strings for UUIDs of artifact and user. flys-artifacts/trunk@2462 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 04 Aug 2011 10:24:23 +0000
parents 9a1a3080ad98
children 8637756275e5
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Aug 03 16:40:04 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Aug 04 10:24:23 2011 +0000
@@ -1,3 +1,8 @@
+2011-08-04  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java:
+	  Be a bit more tolerant about empty strings for UUIDs of artifact and user.
+
 2011-08-03  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	Bring user specific meta data service to life.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java	Wed Aug 03 16:40:04 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java	Thu Aug 04 10:24:23 2011 +0000
@@ -52,9 +52,19 @@
         String artifactId = XMLUtils.xpathString(
             data, XPATH_ARTIFACT_ID, ArtifactNamespaceContext.INSTANCE);
 
+        if (artifactId != null
+        && (artifactId = artifactId.trim()).length() == 0) {
+            artifactId = null;
+        }
+
         String userId = XMLUtils.xpathString(
             data, XPATH_USER_ID, ArtifactNamespaceContext.INSTANCE);
 
+        if (userId != null
+        && (userId = userId.trim()).length() == 0) {
+            userId = null;
+        }
+
         String outs = XMLUtils.xpathString(
             data, XPATH_OUTS, ArtifactNamespaceContext.INSTANCE);
 
@@ -147,7 +157,9 @@
         Map<String, Object> data = splitParameters(
             parameters, new HashMap<String, Object>());
 
-        String [] outs = outsString.split("\\s*,\\s*");
+        String [] outs = outsString == null
+            ? new String [0]
+            : outsString.split("\\s*,\\s*");
         
         Recommendations rec = Recommendations.getInstance();
         rec.recommend(

http://dive4elements.wald.intevation.org