diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java index e906627146..b43e316478 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java @@ -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. * * * @@ -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;