Issue #2581 improve LSR error handling because there was yet another
event type missing Change-Id: I954d408ecfcfda14f3856f4afc7c04e7ef8148be Former-commit-id:85d8f6de32
[formerly738f97cab1
] [formerlyeb96c396c2
] [formerly85d8f6de32
[formerly738f97cab1
] [formerlyeb96c396c2
] [formerlyb6a21ccb7c
[formerlyeb96c396c2
[formerly b85ccd6315e5506c67c39f939c71af363d15a45f]]]] Former-commit-id:b6a21ccb7c
Former-commit-id:e88fd9b8c5
[formerlyff88e4ab99
] [formerly bee76b7681ee23a6fc910b891da62bad416be0e8 [formerly1b0a722e02
]] Former-commit-id: 66921b4c9694329d3e75c41511e58c7343b02109 [formerly7c2dc369ff
] Former-commit-id:e258c6e723
This commit is contained in:
parent
18410979ad
commit
efa03f4d61
5 changed files with 184 additions and 19 deletions
|
@ -35,6 +35,7 @@ import java.util.Map;
|
|||
* Oct 14, 2009 jkorman Initial creation
|
||||
* Dec 09, 2013 2581 njensen Added freezing drizzle
|
||||
* Jan 03, 2014 2581 njensen Added coastal flood
|
||||
* Jan 13, 2014 2581 njensen Added debris flow
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -85,7 +86,8 @@ public enum LSREventType {
|
|||
WATERSPOUT("WATER SPOUT",38,LSRUnits.NOUNITS),
|
||||
WILDFIRE("WILDFIRE",39,LSRUnits.NOUNITS),
|
||||
FREEZINGDRIZZLE("FREEZING DRIZZLE", 40, LSRUnits.NOUNITS),
|
||||
COASTALFLOOD("COASTAL FLOOD", 41, LSRUnits.NOUNITS);
|
||||
COASTALFLOOD("COASTAL FLOOD", 41, LSRUnits.NOUNITS),
|
||||
DEBRISFLOW("DEBRIS FLOW", 42, LSRUnits.NOUNITS);
|
||||
|
||||
private final String eventName;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
|||
Export-Package: com.raytheon.uf.common.dataplugin,
|
||||
com.raytheon.uf.common.dataplugin.annotations,
|
||||
com.raytheon.uf.common.dataplugin.defaults,
|
||||
com.raytheon.uf.common.dataplugin.exception,
|
||||
com.raytheon.uf.common.dataplugin.message,
|
||||
com.raytheon.uf.common.dataplugin.persist,
|
||||
com.raytheon.uf.common.dataplugin.request
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.dataplugin.exception;
|
||||
|
||||
/**
|
||||
* An exception for bad data. Intended primarily to be subclassed but
|
||||
* potentially used in catch blocks.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 13, 2014 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class BadDataException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*
|
||||
*/
|
||||
public BadDataException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public BadDataException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public BadDataException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
*/
|
||||
public BadDataException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.dataplugin.exception;
|
||||
|
||||
/**
|
||||
* An exception for when the data may be valid but the code does not recognize
|
||||
* it and/or doesn't know to handle it.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 13, 2014 2581 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class UnrecognizedDataException extends BadDataException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*
|
||||
*/
|
||||
public UnrecognizedDataException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public UnrecognizedDataException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public UnrecognizedDataException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
*/
|
||||
public UnrecognizedDataException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -29,6 +29,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.uf.common.dataplugin.exception.UnrecognizedDataException;
|
||||
import com.raytheon.uf.common.dataplugin.lsr.LSREventType;
|
||||
import com.raytheon.uf.common.dataplugin.lsr.LocalStormReport;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
|
@ -55,6 +56,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* Dec 09, 2013 2581 njensen Reuse patterns for efficiency
|
||||
* Check entire time line looking for latlon
|
||||
* Jan 07, 2013 2581 njensen Check to end of string for source, not a set length
|
||||
* Jan 13, 2013 2581 njensen Improved error handling and logging
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -315,26 +317,32 @@ public class LSRParser {
|
|||
LocalStormReport rpt = new LocalStormReport();
|
||||
String s = r.getReportLine();
|
||||
|
||||
if (parseTimeLine(s, rpt)) {
|
||||
List<InternalReport> rptLines = r.getSubLines();
|
||||
if (rptLines != null) {
|
||||
r = rptLines.get(0);
|
||||
if (InternalType.DATE.equals(r.getLineType())) {
|
||||
s = r.getReportLine();
|
||||
if (parseDateLine(s, rpt)) {
|
||||
// Now check the remarks section.
|
||||
parseRemarks(rptLines, rpt);
|
||||
rpt.setWmoHeader(wmoHeader
|
||||
.getWmoHeader());
|
||||
rpt.setOfficeid(officeid);
|
||||
rpt.setTraceId(traceId);
|
||||
try {
|
||||
if (parseTimeLine(s, rpt)) {
|
||||
List<InternalReport> rptLines = r.getSubLines();
|
||||
if (rptLines != null) {
|
||||
r = rptLines.get(0);
|
||||
if (InternalType.DATE.equals(r
|
||||
.getLineType())) {
|
||||
s = r.getReportLine();
|
||||
if (parseDateLine(s, rpt)) {
|
||||
// Now check the remarks section.
|
||||
parseRemarks(rptLines, rpt);
|
||||
rpt.setWmoHeader(wmoHeader
|
||||
.getWmoHeader());
|
||||
rpt.setOfficeid(officeid);
|
||||
rpt.setTraceId(traceId);
|
||||
|
||||
reports.add(rpt);
|
||||
reports.add(rpt);
|
||||
}
|
||||
} else {
|
||||
logger.error("Date Line expected");
|
||||
}
|
||||
} else {
|
||||
logger.error("Date Line expected");
|
||||
}
|
||||
}
|
||||
} catch (UnrecognizedDataException e) {
|
||||
logger.error("Error decoding line " + s
|
||||
+ " - skipping this entry", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -343,7 +351,8 @@ public class LSRParser {
|
|||
return reports;
|
||||
}
|
||||
|
||||
private boolean parseTimeLine(String timeLine, LocalStormReport rpt) {
|
||||
private boolean parseTimeLine(String timeLine, LocalStormReport rpt)
|
||||
throws UnrecognizedDataException {
|
||||
boolean timeOk = false;
|
||||
|
||||
if (timeLine != null) {
|
||||
|
@ -366,7 +375,12 @@ public class LSRParser {
|
|||
}
|
||||
}
|
||||
ss = timeLine.substring(EVENT, EVENT + EVENT_LENGTH).trim();
|
||||
rpt.setEventType(LSREventType.lookup(ss));
|
||||
LSREventType eventType = LSREventType.lookup(ss);
|
||||
if (eventType == null) {
|
||||
throw new UnrecognizedDataException(
|
||||
"LSRParser does not recognize eventType " + ss);
|
||||
}
|
||||
rpt.setEventType(eventType);
|
||||
|
||||
ss = timeLine.substring(LOCATION, LOCATION + LOCATION_LENGTH)
|
||||
.trim();
|
||||
|
|
Loading…
Add table
Reference in a new issue