ServletModule exception cleanup + different error templates for admin + open postings...
[mir.git] / source / mircoders / servlet / ServletModuleFileEdit.java
index 97ba55f..c93712e 100755 (executable)
@@ -45,7 +45,8 @@ import mir.log.LoggerWrapper;
 import mir.misc.FileExtFilter;
 import mir.misc.HTMLTemplateProcessor;
 import mir.servlet.ServletModule;
-import mir.servlet.ServletModuleException;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
 import freemarker.template.SimpleHash;
 import freemarker.template.SimpleList;
 
@@ -55,7 +56,7 @@ import freemarker.template.SimpleList;
  *  in the config file.
  *
  * @author $Author: zapata $
- * @version $Revision: 1.5 $ $Date: 2003/02/23 05:00:15 $
+ * @version $Revision: 1.6 $ $Date: 2003/03/06 05:40:40 $
  *
  */
 
@@ -84,8 +85,7 @@ public class ServletModuleFileEdit extends ServletModule
     templateConfirmString =configuration.getString("ServletModule.FileEdit.ConfirmTemplate");
   }
 
-  public void list(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleException
+  public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
   {
 // fetch and deliver
     try {
@@ -105,15 +105,15 @@ public class ServletModuleFileEdit extends ServletModule
 
       HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
     }
-    catch (IOException e) {throw new ServletModuleException(e.toString());}
-    catch (Exception e) {throw new ServletModuleException(e.toString());}
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
   }
 
-  public void edit(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleException
+  public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
   {
     String filename = req.getParameter("filename");
-    if (filename == null) throw new ServletModuleException("No filename specified");
+    if (filename == null) throw new ServletModuleExc("No filename specified");
     try {
 
       File f = new File(_dirName, filename);
@@ -131,16 +131,17 @@ public class ServletModuleFileEdit extends ServletModule
 
 
       deliver(req, res, withValues, null, templateObjektString);
-    } catch (Exception e) {
-      throw new ServletModuleException(e.toString());
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
     }
   }
 
-  public void update(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleException
+  public void update(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
   {
     String filename = req.getParameter("filename");
-    if (filename == null) throw new ServletModuleException("No filename specified");
+
+    if (filename == null) throw new ServletModuleExc("No filename specified");
     try {
 
       File f = new File(_dirName, filename);
@@ -154,8 +155,9 @@ public class ServletModuleFileEdit extends ServletModule
       out.close();
 
       edit(req, res);
-    } catch (Exception e) {
-      throw new ServletModuleException(e.toString());
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
     }
   }
 }