Merge "Omaha #3469 Improve logging of invalid grib1 files." into omaha_14.4.1

Former-commit-id: 5a7765628b [formerly 8008022af6] [formerly d12e58c56b [formerly 56541a5e8c0e5222b8ae06362a799aab05a76466]]
Former-commit-id: d12e58c56b
Former-commit-id: 30d7205ac2
This commit is contained in:
Richard Peter 2014-07-30 18:02:51 -05:00 committed by Gerrit Code Review
commit 6a8c7811b5

View file

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