Omaha #3469 Improve logging of invalid grib1 files.

Former-commit-id: af299b29c0 [formerly a8dd24f7fa] [formerly fa77d8afc6] [formerly af299b29c0 [formerly a8dd24f7fa] [formerly fa77d8afc6] [formerly 95f16c448f [formerly fa77d8afc6 [formerly 043b5709262c5cc01a280f48c61b17fed32c4b59]]]]
Former-commit-id: 95f16c448f
Former-commit-id: bc29380561 [formerly df7e06527c] [formerly 1ae30c5ce9e9783bd584e122d340763395baf598 [formerly a82cd38be2]]
Former-commit-id: d81c2e4aae2a78028c9abb9153c8f80e99f3739c [formerly f78328708e]
Former-commit-id: 7babff850d
This commit is contained in:
Ben Steffensmeier 2014-07-30 16:31:45 -05:00
parent a5f278650a
commit 02dfd691e0

View file

@ -98,6 +98,7 @@ import com.raytheon.uf.common.util.mapping.MultipleMappingException;
* Oct 07, 2013 2402 bsteffen Decode GribDecodeMessage instead of
* files.
* Oct 15, 2013 2473 bsteffen Removed deprecated and unused code.
* Jul 30, 2014 3469 bsteffen Improve logging of invalid files.
*
* </pre>
*
@ -164,11 +165,14 @@ public class Grib1Decoder extends AbstractDecoder {
}
return gribRecords.toArray(new GridRecord[] {});
} catch (IOException e) {
throw new GribException("Failed to decode grib1 file: [" + fileName
+ "]", e);
throw new GribException("IO failure decoding grib1 file: ["
+ fileName + "]", e);
} catch (NoValidGribException e) {
throw new GribException(
"Invalid grib1 message: [" + fileName + "]", e);
} catch (Exception e) {
throw new GribException("Unexpected error in grib1 file: ["
+ fileName + "]", e);
} finally {
if (raf != null) {
try {
@ -424,6 +428,9 @@ public class Grib1Decoder extends AbstractDecoder {
}
}
if (data == null) {
throw new GribException("No valid data found in grib record.");
}
if (gdsVars != null) {
correctForScanMode(data, gdsVars.getNx(), gdsVars.getNy(),
bmsPresent, scanMode);
@ -1012,8 +1019,7 @@ public class Grib1Decoder extends AbstractDecoder {
* The value of the level
* @return The converted level type information
*/
private float[] convertGrib1LevelInfo(int ltype1, float lval1,
float lval2) {
private float[] convertGrib1LevelInfo(int ltype1, float lval1, float lval2) {
float level1Type = ltype1;
float level1Scale = 0;
float level1Value = 0;