Issue #2940 Better error message for bad XMRG config in FFMP

Former-commit-id: dfa3f534b96852975afcd13a6bed653b0f3b8f40
This commit is contained in:
Dave Hladky 2014-04-03 16:55:12 -05:00
parent c310707a46
commit 82be445e97
2 changed files with 28 additions and 9 deletions

View file

@ -136,6 +136,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIRatioDiff;
* re-query with every update.
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Apr 24, 2014 2940 dhladky Prevent storage of bad records.
* </pre>
*
* @author dhladky
@ -697,10 +698,10 @@ public class FFMPGenerator extends CompositeProductGenerator implements
FFMPProcessor ffmp = new FFMPProcessor(config, generator,
ffmpRec, template);
ffmpRec = ffmp.processFFMP(ffmpProduct);
ffmpRec.constructDataURI();
if (ffmpRec != null) {
ffmpRec.constructDataURI();
persistRecord(ffmpRec);
processDataContainer(ffmpRec, siteKey);
// Now that we have the data container,

View file

@ -37,6 +37,7 @@ import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.datum.PixelInCell;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.exception.MalformedDataException;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPDataContainer;
@ -260,9 +261,7 @@ public class FFMPProcessor {
try {
xmrg = (XmrgFile) config.getSourceData(
source.getSourceName()).get(dataKey);
this.extent = getExtents(source.getHrapGridFactor());
setHRAPSubGrid(extent, source.getHrapGridFactor());
xmrgData = xmrg.getData(extent);
xmrgData = getXMRGData();
} catch (Exception e) {
fireBadConfigMessage(type, e);
return;
@ -610,6 +609,7 @@ public class FFMPProcessor {
}
catch (Exception e) {
ffmpRec = null;
throw new Exception(
"FFMPProcessor: Failed to process source domain: "
+ source.getSourceName() + ": "
@ -704,6 +704,7 @@ public class FFMPProcessor {
}
} catch (Exception e) {
ffmpRec = null;
throw new Exception("FFMPProcessor: Failed to process source: "
+ source.getSourceName());
}
@ -735,9 +736,7 @@ public class FFMPProcessor {
try {
xmrg = (XmrgFile) config.getSourceData(source.getSourceName()).get(
dataKey);
this.extent = getExtents(source.getHrapGridFactor());
setHRAPSubGrid(extent, source.getHrapGridFactor());
xmrgData = xmrg.getData(extent);
xmrgData = getXMRGData();
recdate = xmrg.getHeader().getValidDate();
} catch (Exception e) {
fireBadConfigMessage(type, e);
@ -804,6 +803,7 @@ public class FFMPProcessor {
}
} catch (Exception e) {
ffmpRec = null;
statusHandler.error("Unable to process VGB: "+type, e);
}
}
@ -1820,8 +1820,26 @@ public class FFMPProcessor {
sb.append("Record: " + gribRec.getDataURI() + " \n");
}
}
// null out the record it is garbage.
ffmpRec = null;
statusHandler.handle(Priority.ERROR, sb.toString(), e);
}
/**
* Gets the XMRG data array
*
* @return
*/
private short[][] getXMRGData() throws Exception {
this.extent = getExtents(source.getHrapGridFactor());
setHRAPSubGrid(extent, source.getHrapGridFactor());
if (xmrg.getHrapExtent() != null) {
xmrgData = xmrg.getData(extent);
} else {
throw new MalformedDataException("The XMRG data is malformed or the file is non-readable.");
}
return xmrgData;
}
}