changeset 715:0aeac0fe5db2

Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242). gnv/trunk@986 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 26 Apr 2010 12:28:35 +0000
parents 21735fb8d29b
children 8642356d9887
files gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java
diffstat 3 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Mon Apr 26 10:32:22 2010 +0000
+++ b/gnv/ChangeLog	Mon Apr 26 12:28:35 2010 +0000
@@ -1,3 +1,11 @@
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue236 & Issue242
+
+	* src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Display
+	  error messages if the artifact server is down - this have been broken.
+
 2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	  Issue258
--- a/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java	Mon Apr 26 10:32:22 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java	Mon Apr 26 12:28:35 2010 +0000
@@ -7,6 +7,7 @@
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
 
 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
 
 import de.intevation.gnv.propertiesreader.PropertiesReader;
 import de.intevation.gnv.propertiesreader.PropertiesReaderFactory;
@@ -80,10 +81,20 @@
             ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
                 .getInstance().getArtifactDatabaseClient(locale);
             request.getSession().setAttribute(Globals.LOCALE_KEY, locale);
+            ArtifactObject artifactFactory = sm.getSelectedArtifactFactory();
+
+            if (artifactFactory == null) {
+                logger.error("No connection to artifact server.");
+                request.setAttribute(
+                    CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                    "java.io.ioexception..connection.refused");
+
+                return super.getExceptionForward(mapping);
+            }
 
             ArtifactDescription artifactDescription =
                 adc.getCurrentStepDescription(
-                    sm.getSelectedArtifactFactory(),
+                    artifactFactory,
                     sm.getCurrentArtifact(),
                     true);
 
--- a/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java	Mon Apr 26 10:32:22 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java	Mon Apr 26 12:28:35 2010 +0000
@@ -60,7 +60,7 @@
         catch (ArtifactDatabaseClientException e) {
             log.error(e, e);
             request.setAttribute(
-                CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID,
+                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
                 e.getMessage());
 
             return super.getExceptionForward(mapping);

http://dive4elements.wald.intevation.org