Issue #2489 Fix SfcObs NPE.
Former-commit-id:ddf506ceac
[formerlyf9ee49fac5
[formerly 3013c7d2bbf38ab9c27491eb3cade83eaafc35aa]] Former-commit-id:f9ee49fac5
Former-commit-id:59d8afc639
This commit is contained in:
parent
90a54524c6
commit
4f29903ddc
3 changed files with 27 additions and 11 deletions
|
@ -36,9 +36,10 @@ import java.util.Map;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20070925 391 jkorman Initial Coding.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 25, 2007 391 jkorman Initial Coding.
|
||||
* Oct 29, 2013 2489 bsteffen Add NAVTEX_END_PART
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,6 +71,9 @@ public class SfcObsPart {
|
|||
|
||||
public static final SfcObsPart MAROB_PART = new SfcObsPart("MAROB",true);
|
||||
|
||||
public static final SfcObsPart NAVTEX_END_PART = new SfcObsPart("NNNN",
|
||||
true);
|
||||
|
||||
private static final Map<String, SfcObsPart> OBS_TYPE_MAP = new HashMap<String, SfcObsPart>();
|
||||
static {
|
||||
OBS_TYPE_MAP.put(AAXX_PART.partValue, AAXX_PART);
|
||||
|
|
|
@ -31,9 +31,10 @@ import java.util.List;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20070925 391 jkorman Initial Coding.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 25, 2007 391 jkorman Initial Coding.
|
||||
* Oct 29, 2013 2489 bsteffen Add checks for NAVTEX_END_PART
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -136,6 +137,17 @@ public class SfcObsSubMessage {
|
|||
// just throw it away.
|
||||
} else if (SfcObsPart.ME_PART.equals(part)) {
|
||||
break;
|
||||
} else if (SfcObsPart.NAVTEX_END_PART.equals(part)) {
|
||||
/*
|
||||
* NNNN is an end of message token for some of the sbn
|
||||
* data(NAVTEX generated data) and it is not a valid
|
||||
* observation. If NNNN is the only part in the report then
|
||||
* it will be ignored completely(dataWritten will be false).
|
||||
* If there is other parts before or after NNNN then it will
|
||||
* be included in the report.
|
||||
*/
|
||||
sb.append(" ");
|
||||
sb.append(part.getPartValue());
|
||||
} else {
|
||||
sb.append(" ");
|
||||
sb.append(part.getPartValue());
|
||||
|
|
|
@ -34,11 +34,11 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Oct 19, 2007 391 jkorman Initial Coding.
|
||||
* Oct 29, 2013 2489 bsteffen Add null check to matchElement.
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20071019 391 jkorman Initial coding.
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -166,7 +166,7 @@ public abstract class AbstractSfcObsDecoder implements ISfcObsDecoder {
|
|||
*/
|
||||
public static final boolean matchElement(String element, String pattern) {
|
||||
boolean matches = false;
|
||||
if (pattern != null) {
|
||||
if (pattern != null && element != null) {
|
||||
Pattern p = Pattern.compile(pattern);
|
||||
Matcher m = p.matcher(element);
|
||||
matches = m.find();
|
||||
|
|
Loading…
Add table
Reference in a new issue