Add debugging for NPE in GeneralOptimizationDialog
This commit is contained in:
parent
898c024cb7
commit
2ade1f3ac7
@ -1,6 +1,7 @@
|
|||||||
2012-04-09 Sampo Niskanen
|
2012-04-09 Sampo Niskanen
|
||||||
|
|
||||||
* [BUG] Cancelling simulation causes later simulations to fail
|
* [BUG] Cancelling simulation causes later simulations to fail
|
||||||
|
* Add debugging for NPE in GeneralOptimizationDialog
|
||||||
|
|
||||||
2012-03-27 Sampo Niskanen
|
2012-03-27 Sampo Niskanen
|
||||||
|
|
||||||
|
@ -1014,7 +1014,7 @@ public class GeneralOptimizationDialog extends JDialog {
|
|||||||
|
|
||||||
|
|
||||||
simulationSelectionCombo.setModel(new DefaultComboBoxModel(simulations.toArray()));
|
simulationSelectionCombo.setModel(new DefaultComboBoxModel(simulations.toArray()));
|
||||||
|
simulationSelectionCombo.setSelectedIndex(0);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
for (int i = 0; i < simulations.size(); i++) {
|
for (int i = 0; i < simulations.size(); i++) {
|
||||||
if (simulations.get(i).toString().equals(current)) {
|
if (simulations.get(i).toString().equals(current)) {
|
||||||
@ -1334,7 +1334,17 @@ public class GeneralOptimizationDialog extends JDialog {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Simulation getSelectedSimulation() {
|
private Simulation getSelectedSimulation() {
|
||||||
return ((Named<Simulation>) simulationSelectionCombo.getSelectedItem()).get();
|
/* This is to debug a NPE where the returned selected item is null. */
|
||||||
|
Object item = simulationSelectionCombo.getSelectedItem();
|
||||||
|
if (item == null) {
|
||||||
|
String s = "Selected simulation is null:";
|
||||||
|
s = s + " item count=" + simulationSelectionCombo.getItemCount();
|
||||||
|
for (int i = 0; i < simulationSelectionCombo.getItemCount(); i++) {
|
||||||
|
s = s + " [" + i + "]=" + simulationSelectionCombo.getItemAt(i);
|
||||||
|
}
|
||||||
|
throw new BugException(s);
|
||||||
|
}
|
||||||
|
return ((Named<Simulation>) item).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user