Issue #2940 Better error message for bad XMRG config in FFMP
Former-commit-id:82be445e97
[formerly2f4c0cd364
[formerly dfa3f534b96852975afcd13a6bed653b0f3b8f40]] Former-commit-id:2f4c0cd364
Former-commit-id:dc3b99cbf4
This commit is contained in:
parent
b1e102014e
commit
a0a4085459
2 changed files with 28 additions and 9 deletions
|
@ -136,6 +136,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIRatioDiff;
|
||||||
* re-query with every update.
|
* re-query with every update.
|
||||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||||
|
* Apr 24, 2014 2940 dhladky Prevent storage of bad records.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
|
@ -697,10 +698,10 @@ public class FFMPGenerator extends CompositeProductGenerator implements
|
||||||
FFMPProcessor ffmp = new FFMPProcessor(config, generator,
|
FFMPProcessor ffmp = new FFMPProcessor(config, generator,
|
||||||
ffmpRec, template);
|
ffmpRec, template);
|
||||||
ffmpRec = ffmp.processFFMP(ffmpProduct);
|
ffmpRec = ffmp.processFFMP(ffmpProduct);
|
||||||
ffmpRec.constructDataURI();
|
|
||||||
|
|
||||||
if (ffmpRec != null) {
|
if (ffmpRec != null) {
|
||||||
|
|
||||||
|
ffmpRec.constructDataURI();
|
||||||
persistRecord(ffmpRec);
|
persistRecord(ffmpRec);
|
||||||
processDataContainer(ffmpRec, siteKey);
|
processDataContainer(ffmpRec, siteKey);
|
||||||
// Now that we have the data container,
|
// Now that we have the data container,
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.opengis.referencing.crs.ProjectedCRS;
|
||||||
import org.opengis.referencing.datum.PixelInCell;
|
import org.opengis.referencing.datum.PixelInCell;
|
||||||
import org.opengis.referencing.operation.TransformException;
|
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.FFMPBasin;
|
||||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
|
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
|
||||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPDataContainer;
|
import com.raytheon.uf.common.dataplugin.ffmp.FFMPDataContainer;
|
||||||
|
@ -260,9 +261,7 @@ public class FFMPProcessor {
|
||||||
try {
|
try {
|
||||||
xmrg = (XmrgFile) config.getSourceData(
|
xmrg = (XmrgFile) config.getSourceData(
|
||||||
source.getSourceName()).get(dataKey);
|
source.getSourceName()).get(dataKey);
|
||||||
this.extent = getExtents(source.getHrapGridFactor());
|
xmrgData = getXMRGData();
|
||||||
setHRAPSubGrid(extent, source.getHrapGridFactor());
|
|
||||||
xmrgData = xmrg.getData(extent);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
fireBadConfigMessage(type, e);
|
fireBadConfigMessage(type, e);
|
||||||
return;
|
return;
|
||||||
|
@ -610,6 +609,7 @@ public class FFMPProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
ffmpRec = null;
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"FFMPProcessor: Failed to process source domain: "
|
"FFMPProcessor: Failed to process source domain: "
|
||||||
+ source.getSourceName() + ": "
|
+ source.getSourceName() + ": "
|
||||||
|
@ -704,6 +704,7 @@ public class FFMPProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
ffmpRec = null;
|
||||||
throw new Exception("FFMPProcessor: Failed to process source: "
|
throw new Exception("FFMPProcessor: Failed to process source: "
|
||||||
+ source.getSourceName());
|
+ source.getSourceName());
|
||||||
}
|
}
|
||||||
|
@ -735,9 +736,7 @@ public class FFMPProcessor {
|
||||||
try {
|
try {
|
||||||
xmrg = (XmrgFile) config.getSourceData(source.getSourceName()).get(
|
xmrg = (XmrgFile) config.getSourceData(source.getSourceName()).get(
|
||||||
dataKey);
|
dataKey);
|
||||||
this.extent = getExtents(source.getHrapGridFactor());
|
xmrgData = getXMRGData();
|
||||||
setHRAPSubGrid(extent, source.getHrapGridFactor());
|
|
||||||
xmrgData = xmrg.getData(extent);
|
|
||||||
recdate = xmrg.getHeader().getValidDate();
|
recdate = xmrg.getHeader().getValidDate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
fireBadConfigMessage(type, e);
|
fireBadConfigMessage(type, e);
|
||||||
|
@ -804,6 +803,7 @@ public class FFMPProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
ffmpRec = null;
|
||||||
statusHandler.error("Unable to process VGB: "+type, e);
|
statusHandler.error("Unable to process VGB: "+type, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1820,8 +1820,26 @@ public class FFMPProcessor {
|
||||||
sb.append("Record: " + gribRec.getDataURI() + " \n");
|
sb.append("Record: " + gribRec.getDataURI() + " \n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// null out the record it is garbage.
|
||||||
|
ffmpRec = null;
|
||||||
statusHandler.handle(Priority.ERROR, sb.toString(), e);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue