diff --git a/src/main/java/org/orekit/rugged/errors/Dump.java b/src/main/java/org/orekit/rugged/errors/Dump.java index 6cf19d3419148bb7c6676db04f0716052f01db61..d06de7e4a9308db0abab7da10769702890f6a97e 100644 --- a/src/main/java/org/orekit/rugged/errors/Dump.java +++ b/src/main/java/org/orekit/rugged/errors/Dump.java @@ -170,6 +170,8 @@ class Dump { writer.format(Locale.US, "direct location result: latitude %22.15e longitude %22.15e elevation %22.15e%n", gp.getLatitude(), gp.getLongitude(), gp.getAltitude()); + } else { + writer.format(Locale.US, "direct location result: NULL"); } } @@ -203,6 +205,8 @@ class Dump { writer.format(Locale.US, "inverse location result: lineNumber %22.15e pixelNumber %22.15e%n", pixel.getLineNumber(), pixel.getPixelNumber()); + } else { + writer.format(Locale.US, "inverse location result: NULL"); } } diff --git a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java index 12f3713b06fa20f3f11537821784863db65c726b..74ba805292aeabaac83ad9396bc81911aaffa237 100644 --- a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java +++ b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java @@ -221,6 +221,9 @@ public class DumpReplayer { /** Keyword for target direction. */ private static final String TARGET_DIRECTION = "targetDirection"; + /** Keyword for null result. */ + private static final String NULL_RESULT = "NULL"; + /** Constant elevation for constant elevation algorithm. */ private double constantElevation; @@ -595,15 +598,24 @@ public class DumpReplayer { /** {@inheritDoc} */ @Override public void parse(final int l, final File file, final String line, final String[] fields, final DumpReplayer global) { - if (fields.length < 6 || !fields[0].equals(LATITUDE) || - !fields[2].equals(LONGITUDE) || !fields[4].equals(ELEVATION)) { + if (fields.length == 1) { + if (fields[0].equals(NULL_RESULT)) { + final GeodeticPoint gp = null; + final DumpedCall last = global.calls.get(global.calls.size() - 1); + last.expected = gp; + } else { + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } + } else if (fields.length < 6 || !fields[0].equals(LATITUDE) || + !fields[2].equals(LONGITUDE) || !fields[4].equals(ELEVATION)) { throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } else { + final GeodeticPoint gp = new GeodeticPoint(Double.parseDouble(fields[1]), + Double.parseDouble(fields[3]), + Double.parseDouble(fields[5])); + final DumpedCall last = global.calls.get(global.calls.size() - 1); + last.expected = gp; } - final GeodeticPoint gp = new GeodeticPoint(Double.parseDouble(fields[1]), - Double.parseDouble(fields[3]), - Double.parseDouble(fields[5])); - final DumpedCall last = global.calls.get(global.calls.size() - 1); - last.expected = gp; } }, @@ -806,13 +818,22 @@ public class DumpReplayer { /** {@inheritDoc} */ @Override public void parse(final int l, final File file, final String line, final String[] fields, final DumpReplayer global) { - if (fields.length < 4 || !fields[0].equals(LINE_NUMBER) || !fields[2].equals(PIXEL_NUMBER)) { + if (fields.length == 1) { + if (fields[0].equals(NULL_RESULT)) { + final SensorPixel sp = null; + final DumpedCall last = global.calls.get(global.calls.size() - 1); + last.expected = sp; + } else { + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } + } else if (fields.length < 4 || !fields[0].equals(LINE_NUMBER) || !fields[2].equals(PIXEL_NUMBER)) { throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } else { + final SensorPixel sp = new SensorPixel(Double.parseDouble(fields[1]), + Double.parseDouble(fields[3])); + final DumpedCall last = global.calls.get(global.calls.size() - 1); + last.expected = sp; } - final SensorPixel sp = new SensorPixel(Double.parseDouble(fields[1]), - Double.parseDouble(fields[3])); - final DumpedCall last = global.calls.get(global.calls.size() - 1); - last.expected = sp; } },