changeset 215:e02f50a3ad59

Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception. flys-client/trunk@1657 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 08 Apr 2011 08:51:28 +0000
parents 29c6d9573ae7
children 4b0fb079ead9
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/client/services/AddArtifactService.java flys-client/src/main/java/de/intevation/flys/client/client/services/AdvanceService.java flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java flys-client/src/main/java/de/intevation/flys/client/client/services/CreateCollectionService.java flys-client/src/main/java/de/intevation/flys/client/client/services/DescribeCollectionService.java flys-client/src/main/java/de/intevation/flys/client/client/services/StepForwardService.java flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java flys-client/src/main/java/de/intevation/flys/client/server/AddArtifactServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/AdvanceServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java
diffstat 19 files changed, 166 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/ChangeLog	Fri Apr 08 08:51:28 2011 +0000
@@ -1,3 +1,34 @@
+2011-04-08  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/AdvanceServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/AddArtifactServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/client/services/CreateCollectionService.java,
+	  src/main/java/de/intevation/flys/client/client/services/DescribeCollectionService.java,
+	  src/main/java/de/intevation/flys/client/client/services/ArtifactService.java,
+	  src/main/java/de/intevation/flys/client/client/services/StepForwardService.java,
+	  src/main/java/de/intevation/flys/client/client/services/AdvanceService.java,
+	  src/main/java/de/intevation/flys/client/client/services/AddArtifactService.java:
+	  Improved the exception handling. If an exception occurs specific to an
+	  artifact / collection specific operation, a ServerException is thrown.
+	  The message of this exception is a key that needs to be translated using
+	  the lookup mechanism of FLYSConstants.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterList.java,
+	  src/main/java/de/intevation/flys/client/client/ui/CollectionView.java:
+	  The dialog helper class SC of the SmartGWT framework is used to bring up
+	  warning dialogs that inform the user about errors that occured after the
+	  artifact / collection specific operations.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+	  Added strings for the exceptions thrown in the services.
+
 2011-04-08  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/exceptions/ServerException.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Apr 08 08:51:28 2011 +0000
@@ -111,5 +111,19 @@
     String imageBack();
 
     String discharge_curve();
+
+    // ERRORS
+
+    String error_create_artifact();
+
+    String error_feed_data();
+
+    String error_advance_artifact();
+
+    String error_add_artifact();
+
+    String error_create_collection();
+
+    String error_describe_collection();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Apr 08 08:51:28 2011 +0000
@@ -53,3 +53,10 @@
 imageBack = images/back_en.png
 
 discharge_curve = Discharge Curve
+
+error_create_artifact = Error while creating new project.
+error_feed_data = Error while inserting new data.
+error_advance_artifact = Error while changing the project's state.
+error_add_artifact = Error while inserting new data.
+error_create_collection = Error while creating a new collection.
+error_describe_collection = Error while fetching the projects state.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Apr 08 08:51:28 2011 +0000
@@ -53,3 +53,10 @@
 imageBack = images/back_de.png
 
 discharge_curve = Abflusskurve
+
+error_create_artifact = Fehler beim Erstellen eines neuen Projekts.
+error_feed_data = Fehler beim Hinzuf\u00fcgen neuer Daten.
+error_advance_artifact = Fehler beim Wechseln des Zustands des Projektes.
+error_add_artifact = Fehler beim Hinzuf\u00fcgen neuer Daten.
+error_create_collection = Fehler beim Erstellen einer neuen Collection.
+error_describe_collection = Fehler beim Laden des Projektzustandes.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Apr 08 08:51:28 2011 +0000
@@ -53,3 +53,10 @@
 imageBack = images/back_en.png
 
 discharge_curve = Discharge Curve
+
+error_create_artifact = Error while creating new project.
+error_feed_data = Error while inserting new data.
+error_advance_artifact = Error while changing the project's state.
+error_add_artifact = Error while inserting new data.
+error_create_collection = Error while creating a new collection.
+error_describe_collection = Error while fetching the projects state.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/AddArtifactService.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/AddArtifactService.java	Fri Apr 08 08:51:28 2011 +0000
@@ -3,6 +3,7 @@
 import com.google.gwt.user.client.rpc.RemoteService;
 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.Collection;
 
@@ -25,6 +26,7 @@
      *
      * @return the Collection after the operation.
      */
-    Collection add(Collection collection, Artifact artifact, String url);
+    Collection add(Collection collection, Artifact artifact, String url)
+    throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/AdvanceService.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/AdvanceService.java	Fri Apr 08 08:51:28 2011 +0000
@@ -3,6 +3,7 @@
 import com.google.gwt.user.client.rpc.RemoteService;
 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 
 /**
@@ -22,6 +23,7 @@
      *
      * @return the artifact which description might have been changed.
      */
-    public Artifact advance(String serverUrl, Artifact artifact, String target);
+    public Artifact advance(String serverUrl, Artifact artifact, String target)
+    throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java	Fri Apr 08 08:51:28 2011 +0000
@@ -3,6 +3,7 @@
 import com.google.gwt.user.client.rpc.RemoteService;
 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 
 /**
@@ -22,6 +23,7 @@
      *
      * @return the new artifact.
      */
-    public Artifact create(String serverUrl, String factory);
+    public Artifact create(String serverUrl, String factory)
+    throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/CreateCollectionService.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/CreateCollectionService.java	Fri Apr 08 08:51:28 2011 +0000
@@ -3,6 +3,7 @@
 import com.google.gwt.user.client.rpc.RemoteService;
 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Collection;
 
 
@@ -20,6 +21,7 @@
      *
      * @return the uuid of the created collection.
      */
-    Collection create(String serverUrl, String ownerId);
+    Collection create(String serverUrl, String ownerId)
+    throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/DescribeCollectionService.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/DescribeCollectionService.java	Fri Apr 08 08:51:28 2011 +0000
@@ -3,6 +3,7 @@
 import com.google.gwt.user.client.rpc.RemoteService;
 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Collection;
 
 
@@ -23,6 +24,7 @@
      *
      * @return the Collection after the operation.
      */
-    Collection describe(String uuid, String url);
+    Collection describe(String uuid, String url)
+    throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/StepForwardService.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/StepForwardService.java	Fri Apr 08 08:51:28 2011 +0000
@@ -3,6 +3,7 @@
 import com.google.gwt.user.client.rpc.RemoteService;
 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.Data;
 
@@ -23,6 +24,7 @@
      *
      * @return the artifact which description might have been changed.
      */
-    public Artifact go(String serverUrl, Artifact artifact, Data[] data);
+    public Artifact go(String serverUrl, Artifact artifact, Data[] data)
+    throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Fri Apr 08 08:51:28 2011 +0000
@@ -9,6 +9,7 @@
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
+import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Window;
 import com.smartgwt.client.widgets.layout.Layout;
 import com.smartgwt.client.widgets.layout.VLayout;
@@ -146,7 +147,7 @@
             new AsyncCallback<Collection>() {
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not create the new collection.");
-                    GWT.log(caught.getMessage());
+                    SC.warn(messages.getString(caught.getMessage()));
                 }
 
                 public void onSuccess(Collection collection) {
@@ -158,7 +159,7 @@
 
                             public void onFailure(Throwable caught) {
                                 GWT.log("An error occured while adding artifact.");
-                                GWT.log(caught.getMessage());
+                                SC.warn(messages.getString(caught.getMessage()));
                             }
 
                             public void onSuccess(Collection newCollection) {
@@ -265,7 +266,7 @@
                 new AsyncCallback<Collection>() {
                     public void onFailure(Throwable caught) {
                         GWT.log("Could not DESCRIBE collection.");
-                        GWT.log(caught.getMessage());
+                        SC.warn(messages.getString(caught.getMessage()));
                     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Apr 08 08:51:28 2011 +0000
@@ -7,6 +7,7 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
@@ -210,7 +211,7 @@
                     new AsyncCallback<Artifact>() {
                         public void onFailure(Throwable caught) {
                             GWT.log("Could not create the new artifact.");
-                            GWT.log(caught.getMessage());
+                            SC.warn(MSG.getString(caught.getMessage()));
                         }
 
                         public void onSuccess(Artifact artifact) {
@@ -220,7 +221,7 @@
                             new AsyncCallback<Artifact>() {
                                 public void onFailure(Throwable caught) {
                                     GWT.log("Could not feed the artifact.");
-                                    GWT.log(caught.getMessage());
+                                    SC.warn(caught.getMessage());
                                 }
 
                                 public void onSuccess(Artifact artifact) {
@@ -348,7 +349,7 @@
             new AsyncCallback<Artifact>() {
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not feed the artifact.");
-                    GWT.log(caught.getMessage());
+                    SC.warn(MSG.getString(caught.getMessage()));
                 }
 
                 public void onSuccess(Artifact artifact) {
@@ -373,7 +374,7 @@
             new AsyncCallback<Artifact>() {
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not go back to '" + target + "'");
-                    GWT.log(caught.getMessage());
+                    SC.warn(MSG.getString(caught.getMessage()));
                 }
 
                 public void onSuccess(Artifact artifact) {
--- a/flys-client/src/main/java/de/intevation/flys/client/server/AddArtifactServiceImpl.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/AddArtifactServiceImpl.java	Fri Apr 08 08:51:28 2011 +0000
@@ -9,6 +9,7 @@
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.client.services.AddArtifactService;
@@ -21,7 +22,11 @@
 extends      DescribeCollectionServiceImpl
 implements   AddArtifactService
 {
-    public Collection add(Collection collection, Artifact artifact, String url) {
+    public static final String ERROR_ADD_ARTIFACT = "error_add_artifact";
+
+    public Collection add(Collection collection, Artifact artifact, String url)
+    throws ServerException
+    {
         System.out.println("AddArtifactServiceImpl.add");
 
         Document add = ClientProtocolUtils.newAddArtifactDocument(
@@ -36,16 +41,17 @@
             Collection c = parseCollection(response);
 
             if (c == null) {
-                throw new NullPointerException("No collection returned.");
+                throw new ServerException(ERROR_ADD_ARTIFACT);
             }
 
             return c;
         }
         catch (ConnectionException ce) {
             System.err.println(ce.getLocalizedMessage());
+
         }
 
-        return null;
+        throw new ServerException(ERROR_ADD_ARTIFACT);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/AdvanceServiceImpl.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/AdvanceServiceImpl.java	Fri Apr 08 08:51:28 2011 +0000
@@ -13,6 +13,7 @@
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.client.services.AdvanceService;
 
@@ -30,8 +31,12 @@
 
     public static final String OPERATION_FAILURE = "FAILED";
 
+    public static final String ERROR_ADVANCE_ARTIFACT = "error_advance_artifact";
 
-    public Artifact advance(String serverUrl, Artifact artifact, String target){
+
+    public Artifact advance(String serverUrl, Artifact artifact, String target)
+    throws ServerException
+    {
         Document advance = ClientProtocolUtils.newAdvanceDocument(
             artifact.getUuid(),
             artifact.getHash(),
@@ -48,7 +53,7 @@
                 new DocumentResponseHandler());
 
             if (description == null) {
-                return null;
+                throw new ServerException(ERROR_ADVANCE_ARTIFACT);
             }
 
             String result = XMLUtils.xpathString(
@@ -64,7 +69,7 @@
             System.err.println(ce.getLocalizedMessage());
         }
 
-        return null;
+        throw new ServerException(ERROR_ADVANCE_ARTIFACT);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java	Fri Apr 08 08:51:28 2011 +0000
@@ -10,6 +10,7 @@
 import de.intevation.artifacts.httpclient.http.HttpClient;
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.client.services.ArtifactService;
 
@@ -24,7 +25,14 @@
 extends      RemoteServiceServlet
 implements   ArtifactService
 {
-    public Artifact create(String serverUrl, String factory) {
+    /** The error message key that is thrown if an error occured while artifact
+     * creation.*/
+    public static final String ERROR_CREATE_ARTIFACT = "error_create_artifact";
+
+
+    public Artifact create(String serverUrl, String factory)
+    throws ServerException
+    {
         Document create   = ClientProtocolUtils.newCreateDocument(factory);
         HttpClient client = new HttpClientImpl(serverUrl);
 
@@ -35,7 +43,7 @@
             System.err.println(ce.getLocalizedMessage());
         }
 
-        return null;
+        throw new ServerException(ERROR_CREATE_ARTIFACT);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/CreateCollectionServiceImpl.java	Fri Apr 08 08:51:28 2011 +0000
@@ -13,6 +13,7 @@
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.DefaultCollection;
 import de.intevation.flys.client.client.services.CreateCollectionService;
@@ -32,8 +33,15 @@
     public static final String XPATH_COLLECTION_UUID =
         "/art:result/art:artifact-collection/@art:uuid";
 
+    /** Error message key that is thrown if an error occured while creating
+     *  a new collection.*/
+    public static final String ERROR_CREATE_COLLECTION =
+        "error_create_collection";
 
-    public Collection create(String serverUrl, String ownerId) {
+
+    public Collection create(String serverUrl, String ownerId)
+    throws ServerException
+    {
         System.out.println("Start creating a new collection.");
 
         Document create   =
@@ -47,13 +55,17 @@
             String uuid = XMLUtils.xpathString(
                 doc, XPATH_COLLECTION_UUID, ArtifactNamespaceContext.INSTANCE);
 
+            if (uuid == null || uuid.trim().length() == 0) {
+                throw new ServerException(ERROR_CREATE_COLLECTION);
+            }
+
             return new DefaultCollection(uuid);
         }
         catch (ConnectionException ce) {
             System.err.println(ce.getLocalizedMessage());
         }
 
-        return null;
+        throw new ServerException(ERROR_CREATE_COLLECTION);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java	Fri Apr 08 08:51:28 2011 +0000
@@ -20,6 +20,7 @@
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.CollectionItem;
 import de.intevation.flys.client.shared.model.DefaultCollection;
@@ -40,7 +41,15 @@
 extends      RemoteServiceServlet
 implements   DescribeCollectionService
 {
-    public Collection describe(String uuid, String serverUrl) {
+    /** The error message key that is thrown if an error occured while
+     * describe() a Collection.*/
+    public static final String ERROR_DESCRIBE_COLLECTION =
+        "error_describe_collection";
+
+
+    public Collection describe(String uuid, String serverUrl)
+    throws ServerException
+    {
         System.out.println("DescribeCollectionServiceImpl.describe");
 
         Document describe = ClientProtocolUtils.newDescribeCollectionDocument(
@@ -55,7 +64,7 @@
             Collection c = parseCollection(response);
 
             if (c == null) {
-                throw new NullPointerException("No collection returned.");
+                throw new ServerException(ERROR_DESCRIBE_COLLECTION);
             }
 
             return c;
@@ -64,7 +73,7 @@
             System.err.println(ce.getLocalizedMessage());
         }
 
-        return null;
+        throw new ServerException(ERROR_DESCRIBE_COLLECTION);
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java	Fri Apr 08 08:45:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java	Fri Apr 08 08:51:28 2011 +0000
@@ -11,6 +11,7 @@
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
 
+import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.ArtifactDescription;
 import de.intevation.flys.client.shared.model.Data;
@@ -28,11 +29,15 @@
 extends      AdvanceServiceImpl
 implements   StepForwardService
 {
-    /** XPath that points to the result text of a feed or advance operation.*/
-    public static final String XPATH_RESULT = "/art:result/text()";
+    /** XPath that points to the result type of a feed or advance operation.*/
+    public static final String XPATH_RESULT = "/art:result/@art:type";
 
     /** A constant that marks errors.*/
-    public static final String OPERATION_FAILURE = "FAILED";
+    public static final String OPERATION_FAILURE = "FAILURE";
+
+    /** The error message key that is thrown if an error occured while feeding
+     * new data.*/
+    public static final String ERROR_FEED_DATA = "error_feed_data";
 
 
     /**
@@ -45,13 +50,14 @@
      *
      * @return the modified artifact.
      */
-    public Artifact go(String serverUrl, Artifact artifact, Data[] data) {
+    public Artifact go(String serverUrl, Artifact artifact, Data[] data)
+    throws ServerException
+    {
         Artifact afterFeed = feed(serverUrl, artifact, data);
 
         if (afterFeed == null) {
             System.err.println("StepForwardService.feed() - FAILED");
-            // XXX Better handling here!
-            return null;
+            throw new ServerException(ERROR_FEED_DATA);
         }
 
         ArtifactDescription desc = afterFeed.getArtifactDescription();
@@ -78,7 +84,9 @@
      *
      * @return a new artifact parsed from the description of FEED.
      */
-    protected Artifact feed(String serverUrl, Artifact artifact, Data[] data) {
+    protected Artifact feed(String serverUrl, Artifact artifact, Data[] data)
+    throws    ServerException
+    {
         Document feed = ClientProtocolUtils.newFeedDocument(
             artifact.getUuid(),
             artifact.getHash(),
@@ -96,7 +104,7 @@
 
             if (description == null) {
                 System.err.println("StepForwardService.feed() - FAILED");
-                return artifact;
+                throw new ServerException(ERROR_FEED_DATA);
             }
 
             String result = XMLUtils.xpathString(
@@ -108,14 +116,16 @@
                 System.out.println("StepForwardService.feed() - SUCCESS");
                 return (Artifact) new FLYSArtifactCreator().create(description);
             }
+            else if (result != null && result.equals(OPERATION_FAILURE)) {
+                throw new ServerException(ERROR_FEED_DATA);
+            }
         }
         catch (ConnectionException ce) {
             System.err.println(ce.getLocalizedMessage());
         }
 
         System.err.println("StepForwardService.feed() - FAILED");
-
-        return artifact;
+        throw new ServerException(ERROR_FEED_DATA);
     }
 
 

http://dive4elements.wald.intevation.org