Xcos setup: fix an IndexOutOfBoundsException after 22ee913d 38/17938/2
Clément DAVID [Wed, 16 Mar 2016 14:17:44 +0000 (15:17 +0100)]
Change-Id: Ic2572504b14a896fb433a791050ba2d99c327d0b

scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/dialog/SetupDialog.java

index 280470f..b5afea2 100644 (file)
@@ -486,15 +486,15 @@ public class SetupDialog extends JDialog {
                      */
                     int solverSelectedIndex = solver.getSelectedIndex();
 
-                    VectorOfDouble v = new VectorOfDouble();
-                    v.add(ScicosParameters.FINAL_INTEGRATION_TIME, ((BigDecimal) integration.getValue()).doubleValue());
-                    v.add(ScicosParameters.INTEGRATOR_ABSOLUTE_TOLERANCE, ((BigDecimal) integrator.getValue()).doubleValue());
-                    v.add(ScicosParameters.INTEGRATOR_RELATIVE_TOLERANCE, ((BigDecimal) integratorRel.getValue()).doubleValue());
-                    v.add(ScicosParameters.TOLERANCE_ON_TIME, ((BigDecimal) toleranceOnTime.getValue()).doubleValue());
-                    v.add(ScicosParameters.MAX_INTEGRATION_TIME_INTERVAL, ((BigDecimal) maxIntegrationTime.getValue()).doubleValue());
-                    v.add(ScicosParameters.MAXIMUM_STEP_SIZE, ((BigDecimal) maxStepSize.getValue()).doubleValue());
-                    v.add(ScicosParameters.REAL_TIME_SCALING, ((BigDecimal) rts.getValue()).doubleValue());
-                    v.add(ScicosParameters.SOLVER, AVAILABLE_SOLVERS[solverSelectedIndex].getNumber());
+                    VectorOfDouble v = new VectorOfDouble(8);
+                    v.set(ScicosParameters.FINAL_INTEGRATION_TIME, ((BigDecimal) integration.getValue()).doubleValue());
+                    v.set(ScicosParameters.INTEGRATOR_ABSOLUTE_TOLERANCE, ((BigDecimal) integrator.getValue()).doubleValue());
+                    v.set(ScicosParameters.INTEGRATOR_RELATIVE_TOLERANCE, ((BigDecimal) integratorRel.getValue()).doubleValue());
+                    v.set(ScicosParameters.TOLERANCE_ON_TIME, ((BigDecimal) toleranceOnTime.getValue()).doubleValue());
+                    v.set(ScicosParameters.MAX_INTEGRATION_TIME_INTERVAL, ((BigDecimal) maxIntegrationTime.getValue()).doubleValue());
+                    v.set(ScicosParameters.REAL_TIME_SCALING, ((BigDecimal) rts.getValue()).doubleValue());
+                    v.set(ScicosParameters.SOLVER, AVAILABLE_SOLVERS[solverSelectedIndex].getNumber());
+                    v.set(ScicosParameters.MAXIMUM_STEP_SIZE, ((BigDecimal) maxStepSize.getValue()).doubleValue());
 
                     parameters.setProperties(new JavaController(), v);