Merge "Issue #185 handle CommunicationExceptions from the LevelFactory in remerged ncep grib decoder." into 4-Thin_Client

Former-commit-id: fef3fcb60c [formerly e3e44707a4 [formerly fd448c2a996aef215802dc501b68d28747f66414]]
Former-commit-id: e3e44707a4
Former-commit-id: a914aa38c8
This commit is contained in:
Nate Jensen 2012-02-23 11:50:39 -06:00 committed by Gerrit Code Review
commit b07575c5b3
2 changed files with 10 additions and 1502 deletions

View file

@ -67,6 +67,7 @@ import gov.noaa.nws.ncep.edex.util.grib2vars.Grib2VarsTableLookup;
import gov.noaa.nws.ncep.edex.util.grib2vcrd.Grib2Vcrd; import gov.noaa.nws.ncep.edex.util.grib2vcrd.Grib2Vcrd;
import com.raytheon.edex.util.Util; import com.raytheon.edex.util.Util;
import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.edex.plugin.AbstractDecoder; import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
@ -1193,10 +1194,11 @@ public class Ncgrib1Decoder extends AbstractDecoder {
* The level two scale factor * The level two scale factor
* @param value2 * @param value2
* The level two value * The level two value
* @throws GribException
*/ */
private void getLevelInfo(NcgribModel model, int centerID, int subcenterID, private void getLevelInfo(NcgribModel model, int centerID, int subcenterID,
float levelOneNumber, float scaleFactor1, float value1, float levelOneNumber, float scaleFactor1, float value1,
float levelTwoNumber, float scaleFactor2, float value2) { float levelTwoNumber, float scaleFactor2, float value2) throws GribException {
String levelName = null; String levelName = null;
String levelUnit = null; String levelUnit = null;
double levelOneValue = Level.getInvalidLevelValue(); double levelOneValue = Level.getInvalidLevelValue();
@ -1246,9 +1248,13 @@ public class Ncgrib1Decoder extends AbstractDecoder {
* -1)); * -1));
} }
} }
try {
Level level = LevelFactory.getInstance().getLevel(levelName, Level level = LevelFactory.getInstance().getLevel(levelName,
levelOneValue, levelTwoValue, levelUnit); levelOneValue, levelTwoValue, levelUnit);
model.setLevel(level); model.setLevel(level);
} catch (CommunicationException e) {
throw new GribException("Error loading level.", e);
}
} }
/** /**