Mercurial > dive4elements > gnv-client
changeset 580:377da78ed36b
Display an exception if an error occured while stepping back to a former state (issue183).
gnv/trunk@719 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 01 Mar 2010 15:52:24 +0000 (2010-03-01) |
parents | dc548655a66e |
children | f0f0d4eaee58 |
files | gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java |
diffstat | 2 files changed, 34 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/ChangeLog Mon Mar 01 11:08:07 2010 +0000 +++ b/gnv/ChangeLog Mon Mar 01 15:52:24 2010 +0000 @@ -1,3 +1,11 @@ +2010-03-01 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue183 + + * src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java: + Take care on exceptions and render an error message if an exception + occured. + 2010-03-01 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/java/de/intevation/gnv/action/DoExportAction.java: Removed little
--- a/gnv/src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java Mon Mar 01 11:08:07 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java Mon Mar 01 15:52:24 2010 +0000 @@ -6,6 +6,7 @@ import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; +import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import javax.servlet.http.HttpServletRequest; @@ -49,6 +50,18 @@ SessionModel session = SessionModelFactory.getInstance().getSessionModel( request); + ArtifactDescription ad = session.getArtifactDescription(); + if (ad == null) { + logger.warn("Session timed out."); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + "SessionTimeout has occured"); + new FetchArtifactFactoriesAction().execute( + mapping, form, request, response); + + return super.execute(mapping, form, request, response); + } + // TODO check if target is reachable ArtifactDatabaseClientFactory f = @@ -62,11 +75,19 @@ String target = (String) request.getParameter(URL_STATE_KEY); logger.debug("Step back to previous state: " + target); - client.doAdvance( - artifactFactory, - currentArtifact, - target - ); + try { + client.doAdvance( + artifactFactory, + currentArtifact, + target + ); + } + catch (Exception e) { + logger.error(e, e); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + e.getMessage()); + } return super.execute(mapping, form, request, response); }