diff --git a/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java b/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java index f50e47c8e71c0358ce5a1f0814b86c796cee57f9..094bd7b5c12447f4e7f799676b69912924994a10 100644 --- a/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java +++ b/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java @@ -26,7 +26,6 @@ import java.util.Map; import org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresOptimizer.Optimum; import org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem; import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; import org.orekit.rugged.api.Rugged; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedExceptionWrapper; @@ -163,8 +162,7 @@ public class AdjustmentContext { } catch (RuggedExceptionWrapper rew) { throw rew.getException(); - } catch (OrekitExceptionWrapper oew) { - final OrekitException oe = oew.getException(); + } catch (OrekitException oe) { throw new RuggedException(oe, oe.getSpecifier(), oe.getParts()); } } diff --git a/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java b/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java index 3773d5c73c9b17226e81157a0c237afded58f006..566d791f08a750a1da6c4fe781867352f12c8bcd 100644 --- a/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java +++ b/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java @@ -34,8 +34,6 @@ import org.hipparchus.optim.nonlinear.vector.leastsquares.ParameterValidator; import org.hipparchus.util.FastMath; import org.hipparchus.util.Pair; import org.orekit.bodies.GeodeticPoint; -import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; import org.orekit.rugged.api.Rugged; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedExceptionWrapper; @@ -220,8 +218,6 @@ public class GroundOptimizationProblemBuilder extends OptimizationProblemBuilder } catch (RuggedException re) { throw new RuggedExceptionWrapper(re); - } catch (OrekitException oe) { - throw new OrekitExceptionWrapper(oe); } }; diff --git a/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java b/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java index 41dd778e7fccc6527200dde289f5190e531f91c8..5da3c15629b65f6fbe23666c70f93bfd1c56d7d1 100644 --- a/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java +++ b/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java @@ -35,8 +35,6 @@ import org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem; import org.hipparchus.optim.nonlinear.vector.leastsquares.MultivariateJacobianFunction; import org.hipparchus.optim.nonlinear.vector.leastsquares.ParameterValidator; import org.hipparchus.util.Pair; -import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; import org.orekit.rugged.api.Rugged; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedExceptionWrapper; @@ -254,8 +252,6 @@ public class InterSensorsOptimizationProblemBuilder extends OptimizationProblemB } catch (RuggedException re) { throw new RuggedExceptionWrapper(re); - } catch (OrekitException oe) { - throw new OrekitExceptionWrapper(oe); } }; diff --git a/src/main/java/org/orekit/rugged/adjustment/OptimizationProblemBuilder.java b/src/main/java/org/orekit/rugged/adjustment/OptimizationProblemBuilder.java index 2c607efedfb653e61ecad5606f6c0c12a1720da8..954cc9145ba38b330ad4fb0e60f687cefb198917 100644 --- a/src/main/java/org/orekit/rugged/adjustment/OptimizationProblemBuilder.java +++ b/src/main/java/org/orekit/rugged/adjustment/OptimizationProblemBuilder.java @@ -30,13 +30,11 @@ import org.hipparchus.optim.ConvergenceChecker; import org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem; import org.hipparchus.optim.nonlinear.vector.leastsquares.MultivariateJacobianFunction; import org.hipparchus.optim.nonlinear.vector.leastsquares.ParameterValidator; -import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; +import org.orekit.rugged.adjustment.measurements.Observables; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedExceptionWrapper; import org.orekit.rugged.errors.RuggedMessages; import org.orekit.rugged.linesensor.LineSensor; -import org.orekit.rugged.adjustment.measurements.Observables; import org.orekit.rugged.utils.DSGenerator; import org.orekit.utils.ParameterDriver; @@ -151,19 +149,14 @@ abstract class OptimizationProblemBuilder { // Prevent parameters to exceed their prescribed bounds final ParameterValidator validator = params -> { - try { - int i = 0; - for (final ParameterDriver driver : this.drivers) { - - // let the parameter handle min/max clipping - driver.setNormalizedValue(params.getEntry(i)); - params.setEntry(i++, driver.getNormalizedValue()); - } - return params; + int i = 0; + for (final ParameterDriver driver : this.drivers) { - } catch (OrekitException oe) { - throw new OrekitExceptionWrapper(oe); + // let the parameter handle min/max clipping + driver.setNormalizedValue(params.getEntry(i)); + params.setEntry(i++, driver.getNormalizedValue()); } + return params; }; return validator; diff --git a/src/test/java/org/orekit/rugged/api/RuggedTest.java b/src/test/java/org/orekit/rugged/api/RuggedTest.java index 60eb44093f5ac3892358d6313223479cbb575024..f258f20aa9a0713529300185f37a183fe31239e0 100644 --- a/src/test/java/org/orekit/rugged/api/RuggedTest.java +++ b/src/test/java/org/orekit/rugged/api/RuggedTest.java @@ -54,7 +54,6 @@ import org.orekit.bodies.GeodeticPoint; import org.orekit.data.DataProvidersManager; import org.orekit.data.DirectoryCrawler; import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider; import org.orekit.frames.Frame; import org.orekit.frames.FramesFactory; @@ -1316,8 +1315,6 @@ public class RuggedTest { rollDriver.setValue(roll); pitchDriver.setValue(0); return rugged.inverseLocation("line", gp[referencePixel], 0, dimension).getLineNumber(); - } catch (OrekitException e) { - throw new OrekitExceptionWrapper(e); } catch (RuggedException e) { throw new RuggedExceptionWrapper(e); } @@ -1331,8 +1328,6 @@ public class RuggedTest { rollDriver.setValue(0); pitchDriver.setValue(pitch); return rugged.inverseLocation("line", gp[referencePixel], 0, dimension).getLineNumber(); - } catch (OrekitException e) { - throw new OrekitExceptionWrapper(e); } catch (RuggedException e) { throw new RuggedExceptionWrapper(e); } @@ -1346,8 +1341,6 @@ public class RuggedTest { rollDriver.setValue(roll); pitchDriver.setValue(0); return rugged.inverseLocation("line", gp[referencePixel], 0, dimension).getPixelNumber(); - } catch (OrekitException e) { - throw new OrekitExceptionWrapper(e); } catch (RuggedException e) { throw new RuggedExceptionWrapper(e); } @@ -1361,8 +1354,6 @@ public class RuggedTest { rollDriver.setValue(0); pitchDriver.setValue(pitch); return rugged.inverseLocation("line", gp[referencePixel], 0, dimension).getPixelNumber(); - } catch (OrekitException e) { - throw new OrekitExceptionWrapper(e); } catch (RuggedException e) { throw new RuggedExceptionWrapper(e); } @@ -1373,7 +1364,7 @@ public class RuggedTest { } catch (InvocationTargetException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | URISyntaxException | - OrekitExceptionWrapper | RuggedExceptionWrapper e) { + OrekitException | RuggedExceptionWrapper e) { Assert.fail(e.getLocalizedMessage()); } } diff --git a/src/test/java/org/orekit/rugged/linesensor/FixedRotationTest.java b/src/test/java/org/orekit/rugged/linesensor/FixedRotationTest.java index 946e1f0d9c027303989f128c4bcb885547488765..14cf298f7f4771dca66c805802898c5caf64e890 100644 --- a/src/test/java/org/orekit/rugged/linesensor/FixedRotationTest.java +++ b/src/test/java/org/orekit/rugged/linesensor/FixedRotationTest.java @@ -38,7 +38,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.los.FixedRotation; import org.orekit.rugged.los.LOSBuilder; @@ -199,20 +198,16 @@ public class FixedRotationTest { int[] orders = new int[selected.size()]; orders[index] = 1; UnivariateDifferentiableMatrixFunction f = - differentiator.differentiate((UnivariateMatrixFunction) x -> { - try { - double oldX = driver.getValue(); - double[][] matrix = new double[raw.size()][]; - driver.setValue(x); - for (int i = 0 ; i < raw.size(); ++i) { - matrix[i] = tdl.getLOS(i, AbsoluteDate.J2000_EPOCH).toArray(); - } - driver.setValue(oldX); - return matrix; - } catch (OrekitException oe) { - throw new OrekitExceptionWrapper(oe); - } - }); + differentiator.differentiate((UnivariateMatrixFunction) x -> { + double oldX = driver.getValue(); + double[][] matrix = new double[raw.size()][]; + driver.setValue(x); + for (int i = 0 ; i < raw.size(); ++i) { + matrix[i] = tdl.getLOS(i, AbsoluteDate.J2000_EPOCH).toArray(); + } + driver.setValue(oldX); + return matrix; + }); DerivativeStructure[][] mDS = f.value(factory11.variable(0, driver.getValue())); for (int i = 0; i < raw.size(); ++i) { Vector3D los = tdl.getLOS(i, AbsoluteDate.J2000_EPOCH); diff --git a/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java b/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java index 2734af05eefd0d8ec6036be4de04915112746dd2..cb8aed13ac73e8eef5ce314eb4e71346f7fa28f3 100644 --- a/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java +++ b/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java @@ -39,7 +39,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.los.LOSBuilder; import org.orekit.rugged.los.PolynomialRotation; @@ -216,20 +215,16 @@ public class PolynomialRotationTest { int[] orders = new int[selected.size()]; orders[index] = 1; UnivariateDifferentiableMatrixFunction f = - differentiator.differentiate((UnivariateMatrixFunction) x -> { - try { - double oldX = driver.getValue(); - double[][] matrix = new double[raw.size()][]; - driver.setValue(x); - for (int i = 0 ; i < raw.size(); ++i) { - matrix[i] = tdl.getLOS(i, date).toArray(); - } - driver.setValue(oldX); - return matrix; - } catch (OrekitException oe) { - throw new OrekitExceptionWrapper(oe); - } - }); + differentiator.differentiate((UnivariateMatrixFunction) x -> { + double oldX = driver.getValue(); + double[][] matrix = new double[raw.size()][]; + driver.setValue(x); + for (int i = 0 ; i < raw.size(); ++i) { + matrix[i] = tdl.getLOS(i, date).toArray(); + } + driver.setValue(oldX); + return matrix; + }); DerivativeStructure[][] mDS = f.value(factory11.variable(0, driver.getValue())); for (int i = 0; i < raw.size(); ++i) { Vector3D los = tdl.getLOS(i, date); diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/Refining.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/Refining.java index b5dc3072c0363b02087467594db5e4eff8f665b6..e3e7aa0b196d65337cb0f5d8260cbd179a9af3b8 100644 --- a/src/tutorials/java/fr/cs/examples/refiningPleiades/Refining.java +++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/Refining.java @@ -23,7 +23,6 @@ import java.util.List; import org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresOptimizer.Optimum; import org.orekit.errors.OrekitException; -import org.orekit.errors.OrekitExceptionWrapper; import org.orekit.rugged.adjustment.AdjustmentContext; import org.orekit.rugged.api.Rugged; import org.orekit.rugged.errors.RuggedException; @@ -271,14 +270,10 @@ public class Refining { getLineSensor(sensorName). getParametersDrivers(). filter(driver -> driver.getName().equals(sensorName + rollSuffix) - || driver.getName().equals(sensorName + pitchSuffix)). + || driver.getName().equals(sensorName + pitchSuffix)). forEach(driver -> { - try { - driver.setSelected(true); - driver.setValue(0.0); - } catch (OrekitException e) { - throw new OrekitExceptionWrapper(e); - } + driver.setSelected(true); + driver.setValue(0.0); }); rugged. @@ -286,14 +281,10 @@ public class Refining { getParametersDrivers(). filter(driver -> driver.getName().equals(factorName)). forEach(driver -> { - try { - driver.setSelected(isSelected); - - // default value: no Z scale factor applied - driver.setValue(1.0); - } catch (OrekitException e) { - throw new OrekitExceptionWrapper(e); - } + driver.setSelected(isSelected); + + // default value: no Z scale factor applied + driver.setValue(1.0); }); }