From: mh Date: Sat, 9 Feb 2002 16:54:04 +0000 (+0000) Subject: better error handling X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=2f8ffb33bdba83119d986f64ae3a12854fb52f25;p=mir.git better error handling --- diff --git a/source/mircoders/servlet/ServletModuleOpenIndy.java b/source/mircoders/servlet/ServletModuleOpenIndy.java index 31b99bff..ae502b52 100755 --- a/source/mircoders/servlet/ServletModuleOpenIndy.java +++ b/source/mircoders/servlet/ServletModuleOpenIndy.java @@ -37,12 +37,14 @@ import mircoders.producer.*; public class ServletModuleOpenIndy extends ServletModule { - private String commentFormTemplate, commentFormDoneTemplate, commentFormDupeTemplate; - private String postingFormTemplate, postingFormDoneTemplate, postingFormDupeTemplate; - private ModuleContent contentModule; - private ModuleImages imageModule; - private ModuleTopics themenModule; - private String directOp ="yes"; + private String commentFormTemplate, commentFormDoneTemplate, + commentFormDupeTemplate; + private String postingFormTemplate, postingFormDoneTemplate, + postingFormDupeTemplate; + private ModuleContent contentModule; + private ModuleImages imageModule; + private ModuleTopics themenModule; + private String directOp ="yes"; // Singelton / Kontruktor private static ServletModuleOpenIndy instance = new ServletModuleOpenIndy(); @@ -142,8 +144,8 @@ public class ServletModuleOpenIndy extends ServletModule * Method for delivering the form-Page for open posting */ - public void addposting(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException - { + public void addposting(HttpServletRequest req, HttpServletResponse res) + throws ServletModuleException { SimpleHash mergeData = new SimpleHash(); String numOfMedia = req.getParameter("medianum"); if(numOfMedia==null||numOfMedia.equals("")){ @@ -162,12 +164,15 @@ public class ServletModuleOpenIndy extends ServletModule /** @todo popups missing */ try{ - mergeData.put("languagePopUpData",DatabaseLanguage.getInstance().getPopupData()); + SimpleList popUpData = DatabaseLanguage.getInstance().getPopupData(); + mergeData.put("languagePopUpData", popUpData ); mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList()); } catch (Exception e) { - theLog.printError("languagePopUpData or getTopicslist failed"); - throw new ServletModuleException("smod -- openindy -- getting language or topics failed: "+e.toString()); - } + theLog.printError("languagePopUpData or getTopicslist failed " + +e.toString()); + throw new ServletModuleException("OpenIndy -- failed getting language or topics: "+e.toString()); + } + deliver(req, res, mergeData, postingFormTemplate); } @@ -342,7 +347,7 @@ public class ServletModuleOpenIndy extends ServletModule } mediaValues.put("to_media_type",mediaTypeId); - + //load the classes via reflection String MediaId; Entity mediaEnt = null; @@ -385,6 +390,7 @@ public class ServletModuleOpenIndy extends ServletModule contentEnt.setValueForProperty("is_published","1"); contentEnt.update(); + //dereference mp. -mh mp=null; diff --git a/source/mircoders/storage/DatabaseLanguage.java b/source/mircoders/storage/DatabaseLanguage.java index 6db1af06..502f3268 100755 --- a/source/mircoders/storage/DatabaseLanguage.java +++ b/source/mircoders/storage/DatabaseLanguage.java @@ -42,7 +42,13 @@ public class DatabaseLanguage extends Database implements StorageObject{ this.theTable="language"; } - public SimpleList getPopupData() throws StorageObjectException { return getPopupData("name",false); } + public SimpleList getPopupData() throws StorageObjectException { + SimpleList pData = null; + try { + pData = getPopupData("name",false); + } catch (StorageObjectException e) {System.err.println("FF");} + return pData; + } }