r2075 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator
Author: chatellier Date: 2009-04-06 15:19:21 +0000 (Mon, 06 Apr 2009) New Revision: 2075 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java Log: Replace java.util.logger by commons-logging logger Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-06 14:23:13 UTC (rev 2074) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-06 15:19:21 UTC (rev 2075) @@ -37,8 +37,6 @@ import java.util.Properties; import java.util.SortedMap; import java.util.TreeMap; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.JComponent; @@ -152,7 +150,9 @@ param.setResultEnabled(resultNames); } } catch (Exception eee) { - log.error("Can't init SimulationParameter", eee); + if (log.isErrorEnabled()) { + log.error("Can't init SimulationParameter", eee); + } showMsgBox(eee); } } @@ -169,17 +169,19 @@ proper.load(fos); param.fromProperties(SimulationStorage.getSimulationDirectory(), proper); - } catch (Exception ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't import simulation", e); + } + showMsgBox(e); } finally { try { fos.close(); - } catch (IOException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Can't import simulation", e); + } + showMsgBox(e); } } } @@ -189,17 +191,19 @@ try { fos = new FileOutputStream(f); param.copy().toProperties().store(fos, simulName); - } catch (Exception ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't save simulation", e); + } + showMsgBox(e); } finally { try { fos.close(); - } catch (IOException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Can't save simulation", e); + } + showMsgBox(e); } } } @@ -231,8 +235,10 @@ protected void stopSimulation(SimulationJob job) { job.stop(); - log.info(_("User stop simulation %s", job.getItem().getControl() + if (log.isInfoEnabled()) { + log.info(_("User stop simulation %s", job.getItem().getControl() .getId())); + } } protected void viewLog(SimulationJob job) { @@ -262,8 +268,11 @@ for (Rule r : param.getRules()) { rules.put(r, RuleStorage.getName(r)); } - } catch (Exception eee) { - showMsgBox(eee); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't change region", e); + } + showMsgBox(e); } } @@ -302,7 +311,9 @@ } } } catch (Exception eee) { - log.error("Can't load old Simulation: " + simulName, eee); + if (log.isErrorEnabled()) { + log.error("Can't load old Simulation: " + simulName, eee); + } showMsgBox(eee); } } @@ -320,10 +331,11 @@ Rule ruleTmp = ruleStorage.getNewRuleInstance(); rules.put(ruleTmp, name); param.addRule(ruleTmp); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't add rule", e); + } + showMsgBox(e); } } @@ -340,10 +352,11 @@ for (Rule r : param.getRules()) { try { result.add(RuleStorage.getName(r)); - } catch (Exception ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't get rules", e); + } + showMsgBox(e); } } return result; @@ -387,10 +400,11 @@ try { result = RuleStorage.getParameterValue(getRule(ruleName), paramName); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't get rule param value", e); + } + showMsgBox(e); } } return result; @@ -401,10 +415,11 @@ if (ruleName != null) { try { RuleStorage.setParameterValue(getRule(ruleName), paramName, o); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't set rule param value", e); + } + showMsgBox(e); } } } @@ -418,10 +433,11 @@ result = RegionStorage.getFisheryRegion(tx).getStrategy(); tx.rollbackTransaction(); tx.closeContext(); - } catch (Exception ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't get strategies", e); + } + showMsgBox(e); } return result; } @@ -456,10 +472,11 @@ } tx.rollbackTransaction(); tx.closeContext(); - } catch (Exception ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't get population", e); + } + showMsgBox(e); } return result; } @@ -511,14 +528,16 @@ oldSimulNames.add(0, " "); return oldSimulNames; - } catch (ParseException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); - } catch (IOException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (ParseException e) { + if (log.isErrorEnabled()) { + log.error("Can't get old simulation item", e); + } + showMsgBox(e); + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Can't get old simulation item", e); + } + showMsgBox(e); } return null; } @@ -580,9 +599,10 @@ if (!SensitivityExport.class.isInstance(exInstance)) { result.add(export); } - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't get export names", e); + } } } return result; @@ -634,10 +654,11 @@ AnalysePlan ap = AnalysePlanStorage.getAnalysePlan(name) .getNewAnalysePlanInstance(); getSimulationParameter().addAnalysePlan(ap); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't add analyse plan", e); + } + showMsgBox(e); } } @@ -662,10 +683,11 @@ if (ap != null) { try { result = AnalysePlanStorage.getParameterValue(ap, paramName); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't get analyse plan param value", e); + } + showMsgBox(e); } } return result; @@ -679,10 +701,11 @@ } try { AnalysePlanStorage.setParameterValue(ap, paramName, value); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't set analyse plan param value", e); + } + showMsgBox(e); } } @@ -700,9 +723,10 @@ if (SensitivityExport.class.isInstance(exInstance)) { result.add(export); } - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't get sensitivity export names", e); + } } } return result; @@ -724,9 +748,10 @@ .getNewExportInstance(); sensitivityExports.put(exInstance, name); param.setSensitivityExport(getSensitivityExportList()); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't add sensitivity export", e); + } } } @@ -784,9 +809,10 @@ try { SensitivityStorage sens = SensitivityStorage.getSensitivity(name); result = sens.getParameterNames(); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't get sensitivity sensitivity params names", e); + } } return result; } @@ -796,10 +822,11 @@ try { result = SensitivityStorage.getParameterValue(param .getSensitivityCalculator(), paramName); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't get sensitivity param value", e); + } + showMsgBox(e); } return result; } @@ -811,10 +838,11 @@ SensitivityStorage.setParameterValue(param .getSensitivityCalculator(), paramName, value); } - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); - showMsgBox(ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't set sensitivity param value", e); + } + showMsgBox(e); } } @@ -829,9 +857,10 @@ .getNewSensitivityInstance(); sensitivityCalculator = sensCal; param.setSensitivityCalculator(sensitivityCalculator); - } catch (IsisFishException ex) { - Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, - null, ex); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't set sensitivity", e); + } } } @@ -882,8 +911,9 @@ f.setDomain(domain); f.setComment(comment); f.setPath(path); - if (exist) + if (exist) { removeFactor(f); + } addFactor(f, c); } @@ -910,8 +940,9 @@ f.setComment(comment); f.setDomain(domain); f.setPath(path); - if (exist) + if (exist) { removeFactor(f); + } addFactor(f, c); }
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org