Author: chatellier Date: 2010-04-07 08:50:54 +0000 (Wed, 07 Apr 2010) New Revision: 3017 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java Log: Fix a potential NPE when restarting in process simulation Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2010-04-07 08:43:34 UTC (rev 3016) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2010-04-07 08:50:54 UTC (rev 3017) @@ -586,29 +586,40 @@ // force le download dans le cas de ssh SimulationStorage simulation = launcher.getSimulationStorage( service, control); + + //TODO simulation is null here when a in process simulation + //TODO has been restarted - // on ne fait de post traitement que si - // la simulation n'a pas été arretée - if (!control.isStopSimulationRequest()) { - // post manage this storage - boolean simulationAvailble = true; //exportResult(job, simulation); - - // do posts actions - for (PostAction action : job.getPostActions()) { - try { - action.finished(job, simulation); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error(_("Can't do post action %s", action), eee); + if (simulation != null) { + // on ne fait de post traitement que si + // la simulation n'a pas été arretée + if (!control.isStopSimulationRequest()) { + // post manage this storage + boolean simulationAvailable = true; //exportResult(job, simulation); + + // do posts actions + for (PostAction action : job.getPostActions()) { + try { + action.finished(job, simulation); + } catch (Exception eee) { + if (log.isErrorEnabled()) { + log.error(_("Can't do post action %s", action), eee); + } } } + + // sensitivity calculator analyze result call + // can't do analyze second pass if simulation + // has been deleted + if (simulationAvailable) { + analyzeSensitivityResult(job, simulation); + } } - - // sensitivity calculator analyze result call - // can't do analyze second pass if simulation - // has been deleted - if (simulationAvailble) { - analyzeSensitivityResult(job, simulation); + } + else { + // allow simulation to restart to be properly removed + if (log.isWarnEnabled()) { + log.warn("Check null simulation check (launcher return null simulation)"); } }