Omaha #3272 Throw UnrecognizedDataException instead of a NPE when records weren't found. Switch to slf4j. Updated Manifest per Code review and removed trailing space.

Change-Id: I9a512dcd140e02d092897df4f306c1c25ea84377

Former-commit-id: ca5b7fa9d91d085f0684320a4582a974a4356063
This commit is contained in:
Nathan Bowler 2014-06-23 12:55:42 -04:00
parent 172f18a5b1
commit e2e6724043
3 changed files with 23 additions and 10 deletions

View file

@ -2,9 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tcs Plug-in
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.tcs
Bundle-Version: 1.12.1174.qualifier
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.raytheon.uf.common.dataplugin.tcs;bundle-version="1.0.0",
com.raytheon.uf.edex.decodertools,
com.raytheon.uf.common.pointdata,
@ -16,9 +16,10 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.tcs;bundle-version="1.0.0",
com.raytheon.uf.common.serialization
Import-Package: com.raytheon.edex.esb,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.exception,
com.raytheon.uf.common.datastorage.records,
com.raytheon.uf.common.status,
com.raytheon.uf.common.time,
com.raytheon.uf.common.wmo,
com.raytheon.uf.edex.core,
org.apache.commons.logging
org.slf4j

View file

@ -20,8 +20,8 @@
package com.raytheon.uf.edex.plugin.tcs;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.edex.esb.Headers;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
@ -40,6 +40,7 @@ import com.raytheon.uf.edex.plugin.tcs.decoder.TCSDataAdapter;
* ------------ ---------- ----------- --------------------------
* Nov 12, 2009 jsanchez Initial creation
* May 14, 2014 2536 bclement moved WMO Header to common
* Jun 23, 2014 3272 nabowle Switch to slf4j.
*
* </pre>
*
@ -47,7 +48,7 @@ import com.raytheon.uf.edex.plugin.tcs.decoder.TCSDataAdapter;
* @version 1.0
*/
public class TCSDecoder {
private Log logger = LogFactory.getLog(getClass());
private static Logger logger = LoggerFactory.getLogger(TCSDecoder.class);
private final String pluginName;

View file

@ -24,10 +24,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.edex.esb.Headers;
import com.raytheon.uf.common.dataplugin.exception.UnrecognizedDataException;
import com.raytheon.uf.common.dataplugin.tcs.Radius;
import com.raytheon.uf.common.dataplugin.tcs.TropicalCycloneSummary;
import com.raytheon.uf.common.dataplugin.tcs.util.TCSConstants;
@ -51,6 +52,9 @@ import com.raytheon.uf.edex.plugin.tcs.TropicalCycloneSummaryDao;
* subclasses can use TimeTools
* for time calculations.
* May 14, 2014 2536 bclement moved WMO Header to common, removed constructDataURI() call
* Jun 23, 2014 3272 nabowle Throw UnrecognizedDataException in
* {@link #getDecodedData()} if there were
* no reports. Switch to slf4j.
*
* </pre>
*
@ -59,7 +63,8 @@ import com.raytheon.uf.edex.plugin.tcs.TropicalCycloneSummaryDao;
*/
public abstract class TCSDataAdapter implements TCSConstants {
protected static Log logger = LogFactory.getLog(TCSDataAdapter.class);
protected static Logger logger = LoggerFactory
.getLogger(TCSDataAdapter.class);
protected PointDataDescription pointDataDescription;
@ -124,7 +129,8 @@ public abstract class TCSDataAdapter implements TCSConstants {
return next;
}
public TropicalCycloneSummary getDecodedData() {
public TropicalCycloneSummary getDecodedData()
throws UnrecognizedDataException {
boolean isFirstReport = true;
int COLUMN_WIDTH = 4;
TropicalCycloneSummary headReport = null;
@ -188,6 +194,11 @@ public abstract class TCSDataAdapter implements TCSConstants {
row++;
}
}
if (view == null || headReport == null) {
throw new UnrecognizedDataException("No reports were found.");
}
view.setInt("size", row);
headReport.setPointDataView(view);
return headReport;