r3687 - trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
Author: echatellier Date: 2012-04-26 16:33:33 +0200 (Thu, 26 Apr 2012) New Revision: 3687 Url: http://forge.codelutin.com/repositories/revision/isis-fish/3687 Log: add hack ArrayIndexOutOfBoundException for unknown reason Modified: trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java Modified: trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java 2012-04-26 13:25:20 UTC (rev 3686) +++ trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java 2012-04-26 14:33:33 UTC (rev 3687) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, Code Lutin, Benjamin Poussin + * Copyright (C) 2002 - 2012 Ifremer, Code Lutin, Benjamin Poussin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -209,68 +209,76 @@ */ public Object getValueAt(int rowIndex, int columnIndex) { + // FIXME echatellier : hack ArrayIndexOutOfBoundException for unknown + // reason (very hard to fix properly) + if (rowIndex >= jobs.size()) { + if (columnIndex == 4) { + return new JProgressBar(); // NPE + } else { + return null; + } + } + Object result = ""; - synchronized (jobs) { - SimulationJob job = jobs.get(rowIndex); - SimulationControl control = job.getItem().getControl(); - String id = control.getId(); - SimulationParameter param = job.getItem().getParameter(); + SimulationJob job = jobs.get(rowIndex); + SimulationControl control = job.getItem().getControl(); + String id = control.getId(); + SimulationParameter param = job.getItem().getParameter(); - if (log.isTraceEnabled()) { - log.trace("Update table model : " + "id = " + control.getId() - + ", " + "control.getProgress() = " + control.getProgress() - + ", " + "control.getProgressMax() = " - + control.getProgressMax() + ", " + "control.getDate() = " - + control.getStep()); + if (log.isTraceEnabled()) { + log.trace("Update table model : " + "id = " + control.getId() + + ", " + "control.getProgress() = " + control.getProgress() + + ", " + "control.getProgressMax() = " + + control.getProgressMax() + ", " + "control.getDate() = " + + control.getStep()); + } + + switch (columnIndex) { + case 0: + result = id; + break; + case 1: + if (param.getUseSimulationPlan()) { + int number = param.getSimulationPlanNumber(); + if (number >= 0) { + result = number; + } } - - switch (columnIndex) { - case 0: - result = id; - break; - case 1: + break; + case 2: + if (job.getLauncher() == null) { if (param.getUseSimulationPlan()) { - int number = param.getSimulationPlanNumber(); - if (number >= 0) { - result = number; - } - } - break; - case 2: - if (job.getLauncher() == null) { - if (param.getUseSimulationPlan()) { - result = _("isisfish.queue.masterplan"); - } else { - result = _("isisfish.queue.notstarted"); - } + result = _("isisfish.queue.masterplan"); } else { - result = job.getLauncher().toString(); + result = _("isisfish.queue.notstarted"); } - break; - case 3: - if (control.isStopSimulationRequest()) { - result = _("isisfish.launch.stop"); - } else { - result = control.getText(); - } - break; - case 4: - JProgressBar pb = getProgressBar(job); - pb.setMaximum((int) control.getProgressMax()); - pb.setValue((int) control.getProgress()); - - // progress can be used for other things - TimeStep step = control.getStep(); - if (step != null) { - pb.setString(step.getMonth() + "/" + step.getYear()); - } - else { - pb.setString(""); - } - result = pb; - break; + } else { + result = job.getLauncher().toString(); } + break; + case 3: + if (control.isStopSimulationRequest()) { + result = _("isisfish.launch.stop"); + } else { + result = control.getText(); + } + break; + case 4: + JProgressBar pb = getProgressBar(job); + pb.setMaximum((int) control.getProgressMax()); + pb.setValue((int) control.getProgress()); + + // progress can be used for other things + TimeStep step = control.getStep(); + if (step != null) { + pb.setString(step.getMonth() + "/" + step.getYear()); + } + else { + pb.setString(""); + } + result = pb; + break; } return result; }
participants (1)
-
echatellier@users.forge.codelutin.com