Skip to content
Snippets Groups Projects
Commit 2985889f authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Detect more truncated compact Rinex files.

parent 23eecb2d
No related branches found
No related tags found
No related merge requests found
......@@ -671,6 +671,9 @@ public class HatanakaCompressFilter implements DataFilter {
// read the first two lines of the file
final String line1 = reader.readLine();
final String line2 = reader.readLine();
if (line1 == null || line2 == null) {
throw new OrekitException(OrekitMessages.NOT_A_SUPPORTED_HATANAKA_COMPRESSED_FILE, name);
}
// extract format version
final int cVersion100 = (int) FastMath.rint(100 * parseDouble(line1, 0, 9));
......
......@@ -78,6 +78,16 @@ public class HatanakaCompressFilterTest {
doTestWrong("rinex/truncateB_U_20190320000_15M_30S_MO.crx", OrekitMessages.UNABLE_TO_PARSE_LINE_IN_FILE);
}
@Test
public void testTruncatedCompactHeader() throws IOException {
doTestWrong("rinex/truncateC_U_20190320000_15M_30S_MO.crx", OrekitMessages.NOT_A_SUPPORTED_HATANAKA_COMPRESSED_FILE);
}
@Test
public void testEmpty() throws IOException {
doTestWrong("rinex/emptyFile_U_20190320000_15M_30S_MO.crx", OrekitMessages.NOT_A_SUPPORTED_HATANAKA_COMPRESSED_FILE);
}
@Test
public void testBadClockReset() throws IOException {
doTestWrong("rinex/badclkrst_U_20190320000_10M_10M_MO.crx", OrekitMessages.UNABLE_TO_PARSE_LINE_IN_FILE);
......
3.0 COMPACT RINEX FORMAT CRINEX VERS / TYPE
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment