Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java,v
diff -u -r1.8 -r1.9
--- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java 21 Jul 2005 04:33:07 -0000 1.8
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java 22 Jul 2005 06:58:15 -0000 1.9
@@ -128,4 +128,6 @@
public static final String ERROR_NBAPPLICATION = "error.exception.NbApplication";
+ public static final String ERR_MISSING_PARAM = "error.missingParam";
+
}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/CustomStrutsExceptionHandler.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/Attic/CustomStrutsExceptionHandler.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/CustomStrutsExceptionHandler.java 22 Jul 2005 07:00:10 -0000 1.1
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ http://www.gnu.org/licenses/gpl.txt
+*/
+
+package org.lamsfoundation.lams.tool.noticeboard.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ExceptionHandler;
+import org.apache.struts.config.ExceptionConfig;
+import org.lamsfoundation.lams.tool.noticeboard.NbApplicationException;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants;
+
+/**
+ * Copied from Jacky's class in the survey tool.
+ */
+public class CustomStrutsExceptionHandler extends ExceptionHandler {
+
+ //---------------------------------------------------------------------
+ // Instance Data
+ //---------------------------------------------------------------------
+ private static Logger logger = Logger.getLogger(CustomStrutsExceptionHandler.class);
+
+ // commons logging reference
+ /**
+ * Handle the exception. Standard execute method with addition of logging
+ * the stacktrace.
+ */
+ public ActionForward execute(Exception ex,
+ ExceptionConfig ae,
+ ActionMapping mapping,
+ ActionForm formInstance,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ {
+ // write the exception information to the log file
+ logger.error("fatal System exception: [" + ex.getMessage() + "] ", ex);
+ ActionForward forward = null;
+ String property = null;
+
+ /*
+ * Get the path for the forward either from the exception element or
+ * from the input attribute.
+ */
+
+ String path = null;
+ if (ae.getPath() != null)
+ {
+ path = ae.getPath();
+ }
+ else
+ {
+ path = mapping.getInput();
+ }
+ // Construct the forward object
+ forward = new ActionForward(path);
+
+ // some exceptions do have null messages, so be careful!
+ String exceptionMessage = ex.getMessage();
+ String errorMessage = exceptionMessage == null || exceptionMessage.equals("null") ? ex.getClass().getName() : ex.getMessage();
+ ActionMessage error = null;
+ if (NbApplicationException.class.isInstance(ex) ) {
+ error = new ActionMessage(NoticeboardConstants.ERROR_NBAPPLICATION, errorMessage );
+ }
+ storeException(request, property, error, forward, ae.getScope( ));
+ // process the exception as normal
+ return forward;
+
+
+ }
+}
Index: lams_tool_nb/web/WEB-INF/struts-config.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/web/WEB-INF/Attic/struts-config.xml,v
diff -u -r1.5 -r1.6
--- lams_tool_nb/web/WEB-INF/struts-config.xml 19 Jul 2005 07:25:21 -0000 1.5
+++ lams_tool_nb/web/WEB-INF/struts-config.xml 22 Jul 2005 07:05:12 -0000 1.6
@@ -41,13 +41,13 @@
+ path="/starter/authoring.do"/>
+
+
+
-
+
+
+
-
+