ASM #18257 - Some DPR products not being ingested correctly

Change-Id: I6fe2d7de51a5ec668170d4d12a694632038026e9

Former-commit-id: 039a485a5abf332df83cd6d91d2e4092965bb725
This commit is contained in:
David Friedman 2015-11-17 16:26:55 +00:00
parent dddfc6f47d
commit 738cb0d430
2 changed files with 11 additions and 13 deletions

View file

@ -20,6 +20,7 @@
package com.raytheon.rcm.server.dataarchive;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@ -682,14 +683,14 @@ public class DataArchiveEndpoint extends RadarEventAdapter {
if (pdb.isBzip2Compressed()) {
int uncompressedSize = pdb.getUncompressedSize();
byte[] uncompressed;
try {
InputStream ins = new ByteArrayInputStream(msg, 120,
msg.length - 120);
ins = new BZip2InputStream(ins, false);
try (DataInputStream di = new DataInputStream(
new BZip2InputStream(
new ByteArrayInputStream(msg,
120, msg.length - 120), false))) {
// ByteArrayOutputStream outs = new
// ByteArrayOutputStream(uncompressedSize);
uncompressed = new byte[uncompressedSize];
ins.read(uncompressed);
di.readFully(uncompressed);
} catch (IOException e) {
Log.errorf("Error decompressing product: %s", e);
return msg;

View file

@ -756,21 +756,18 @@ public class Level3BaseRadar {
byte[] msg = new byte[120];
InputStream byt;
if (uncompressedSize + msg.length != theRawRadarByteArray.length) {
InputStream ins = null;
try {
theRadarData.reset();
theRadarData.readFully(msg);
ins = new BZip2InputStream(theRadarData, false);
uncompressed = new byte[uncompressedSize];
ins.read(uncompressed);
try (DataInputStream di = new DataInputStream(
new BZip2InputStream(theRadarData, false))) {
uncompressed = new byte[uncompressedSize];
di.readFully(uncompressed);
}
} catch (IOException e) {
theHandler.handle(Priority.ERROR,
"Error decompressing product: ", e);
return;
} finally {
if (ins != null) {
ins.close();
}
}
theRawRadarByteArray = new byte[120 + uncompressed.length];
System.arraycopy(msg, 0, theRawRadarByteArray, 0, 120);