From 02e8058487687a9e7f2fc7accc1529e79238cd59 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Thu, 11 Feb 2016 14:06:25 -0600 Subject: [PATCH] Omaha #4834 slightly better error logging Change-Id: Ife9a79550b959dce319d4e0c755b87cc4145642e Former-commit-id: 6f8dcebefb0935de3c009b60236a5f8a36812799 --- .../META-INF/MANIFEST.MF | 6 +++--- .../uf/edex/plugin/fssobs/FSSObsGenerator.java | 16 ++++++++-------- .../edex/plugin/fssobs/common/FSSObsConfig.java | 14 ++++++++------ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF index a31b67c6e4..12d84f9c42 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF @@ -11,7 +11,8 @@ Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.12.1153", com.raytheon.uf.edex.decodertools, com.raytheon.uf.common.monitor, com.raytheon.uf.common.localization;bundle-version="1.15.1", - com.raytheon.uf.common.localization.python;bundle-version="1.0.0" + com.raytheon.uf.common.localization.python;bundle-version="1.0.0", + org.slf4j;bundle-version="1.7.12" Export-Package: com.raytheon.uf.edex.plugin.fssobs, com.raytheon.uf.edex.plugin.fssobs.common Import-Package: com.raytheon.uf.common.monitor.config, @@ -26,5 +27,4 @@ Import-Package: com.raytheon.uf.common.monitor.config, com.raytheon.uf.edex.plugin.fssobs, com.raytheon.uf.edex.pointdata, javax.measure.converter, - javax.measure.unit, - org.slf4j + javax.measure.unit diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java index 3695eb8f8c..7d83b80edf 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java @@ -185,14 +185,14 @@ public class FSSObsGenerator extends CompositeProductGenerator implements // We only want what we know how to decode if (reportType != null && inRange) { - - FSSObsRecord fssObsRec = new FSSObsRecord(); - fssObsRec.setReportType(reportType); - fssObsRec.setStationary(isStationary); - fssObsRec = fss_config.getTableRow(uri); - FSSObsDataTransform.buildView(fssObsRec); - fssRecs.add(fssObsRec); - checkThresholds(fssObsRec); + try { + FSSObsRecord fssObsRec = fss_config.getTableRow(uri); + FSSObsDataTransform.buildView(fssObsRec); + fssRecs.add(fssObsRec); + checkThresholds(fssObsRec); + } catch (Exception e) { + statusHandler.error("Error building FSSObsRecord", e); + } } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java index aec0425f7c..f410c0b9b2 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java @@ -73,9 +73,7 @@ public class FSSObsConfig { protected transient final Logger logger = LoggerFactory .getLogger(getClass()); - public FSSObsConfig(URIGenerateMessage genMessage, FSSObsGenerator generator) - throws Exception { - + public FSSObsConfig(URIGenerateMessage genMessage, FSSObsGenerator generator) { this.fssgen = generator; } @@ -84,13 +82,13 @@ public class FSSObsConfig { * * @param uri * @return tableRow + * @throws Exception */ - public FSSObsRecord getTableRow(String uri) { + public FSSObsRecord getTableRow(String uri) throws Exception { String dt = uri.substring(1) .substring(0, uri.substring(1).indexOf("/")); try { - if (dt.equals("obs")) { tableRow = FSSObsUtils.getRecordFromMetar(uri); } else if (dt.equals("sfcobs")) { @@ -98,12 +96,16 @@ public class FSSObsConfig { } else if (dt.equals("ldadmesonet")) { tableRow = FSSObsUtils.getRecordFromMesowest(uri); } - } catch (PluginException e) { statusHandler.handle(Priority.PROBLEM, "Could not create type: " + dt + " URI: " + uri, e); } + if (tableRow == null) { + throw new Exception("Couldn't make FSSObsRecord from type " + + dt + " and URI: " + uri); + } + if (tableRow.getRelativeHumidity() == ObConst.MISSING) { Float RH = FSSObsUtils.getRH(tableRow.getDewpoint(), tableRow.getTemperature());