Omaha #3629 Fix null pointer exceptions from matchElement() replacements
Change-Id: I9fcf81c5179f099c1813f0fa1086c85bdcff4513 Former-commit-id: e0330ab61d027ee3b8512230b64000bb7f3d71f1
This commit is contained in:
parent
26e4c16da4
commit
63069f5adc
8 changed files with 41 additions and 31 deletions
|
@ -206,6 +206,7 @@ public class DRIBUSynopticDecoder extends AbstractSynopticDecoder {
|
|||
String element = reportParser.getElement();
|
||||
Integer lat = null;
|
||||
float divisor = 1000.0f;
|
||||
if (element != null) {
|
||||
if (PATTERN_1357d5.matcher(element).find()) {
|
||||
buoyQuadrant = getInt(element, 0, 1);
|
||||
lat = getInt(element, 1, 6);
|
||||
|
@ -218,6 +219,7 @@ public class DRIBUSynopticDecoder extends AbstractSynopticDecoder {
|
|||
lat = getInt(element, 1, 4);
|
||||
divisor = 10.0f;
|
||||
}
|
||||
}
|
||||
if ((lat != null) && (lat >= 0)) {
|
||||
buoyLatitude = lat.floatValue() / divisor;
|
||||
} else {
|
||||
|
@ -239,6 +241,7 @@ public class DRIBUSynopticDecoder extends AbstractSynopticDecoder {
|
|||
String element = reportParser.getElement();
|
||||
Integer lon = null;
|
||||
float divisor = 1000.0f;
|
||||
if (element != null) {
|
||||
if (PATTERN_d6.matcher(element).find()) {
|
||||
lon = getInt(element, 0, 6);
|
||||
} else if (PATTERN_d5.matcher(element).find()) {
|
||||
|
@ -248,6 +251,7 @@ public class DRIBUSynopticDecoder extends AbstractSynopticDecoder {
|
|||
lon = getInt(element, 0, 4);
|
||||
divisor = 10.0f;
|
||||
}
|
||||
}
|
||||
if ((lon != null) && (lon >= 0)) {
|
||||
buoyLongitude = lon.floatValue() / divisor;
|
||||
} else {
|
||||
|
|
|
@ -81,7 +81,8 @@ public class CMANSynopticDecoder extends LandSynopticDecoder {
|
|||
if (isValid) {
|
||||
reportParser.next();
|
||||
element = reportParser.getElement();
|
||||
if (ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
if (element != null
|
||||
&& ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
try {
|
||||
|
||||
Integer month = getHeader().getMonth();
|
||||
|
|
|
@ -90,7 +90,8 @@ public class LandSynopticDecoder extends AbstractSynopticDecoder {
|
|||
if (isValid) {
|
||||
reportParser.next();
|
||||
element = reportParser.getElement();
|
||||
if (ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
if (element != null
|
||||
&& ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
try {
|
||||
Integer month = getHeader().getMonth();
|
||||
if (month != -1) {
|
||||
|
|
|
@ -79,7 +79,8 @@ public class MAROBSynopticDecoder extends SHIPSynopticDecoder {
|
|||
setReportIdentifier(reportParser.getElement());
|
||||
reportParser.next();
|
||||
element = reportParser.getElement();
|
||||
if (ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
if (element != null
|
||||
&& ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
try {
|
||||
Integer month = getHeader().getMonth();
|
||||
if (month != -1) {
|
||||
|
|
|
@ -100,7 +100,8 @@ public class MobileSynopticDecoder extends AbstractSynopticDecoder {
|
|||
setReportIdentifier(reportParser.getElement());
|
||||
reportParser.next();
|
||||
element = reportParser.getElement();
|
||||
if (ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
if (element != null
|
||||
&& ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
try {
|
||||
Integer month = getHeader().getMonth();
|
||||
if (month != -1) {
|
||||
|
@ -179,7 +180,7 @@ public class MobileSynopticDecoder extends AbstractSynopticDecoder {
|
|||
reportParser.next();
|
||||
String element = reportParser.getElement();
|
||||
|
||||
if (LAT_PATTERN.matcher(element).find()) {
|
||||
if (element != null && LAT_PATTERN.matcher(element).find()) {
|
||||
Integer lat = getInt(element, 2, 5);
|
||||
if (lat != null) {
|
||||
mobileLatitude = lat.floatValue() / 10.0f;
|
||||
|
@ -198,7 +199,7 @@ public class MobileSynopticDecoder extends AbstractSynopticDecoder {
|
|||
reportParser.next();
|
||||
String element = reportParser.getElement();
|
||||
|
||||
if (LON_PATTERN.matcher(element).find()) {
|
||||
if (element != null && LON_PATTERN.matcher(element).find()) {
|
||||
Integer lon = getInt(element, 2, 5);
|
||||
if (lon != null) {
|
||||
mobileLongitude = lon.floatValue() / 10.0f;
|
||||
|
@ -265,7 +266,7 @@ public class MobileSynopticDecoder extends AbstractSynopticDecoder {
|
|||
reportParser.next();
|
||||
String element = reportParser.getElement();
|
||||
|
||||
if (ELEV_PATTERN.matcher(element).find()) {
|
||||
if (element != null && ELEV_PATTERN.matcher(element).find()) {
|
||||
Integer elev = getInt(element, 0, 4);
|
||||
if (elev != null) {
|
||||
if (elev >= 0) {
|
||||
|
|
|
@ -126,7 +126,8 @@ public class SHIPSynopticDecoder extends AbstractSynopticDecoder {
|
|||
}
|
||||
reportParser.next();
|
||||
element = reportParser.getElement();
|
||||
if (ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
if (element != null
|
||||
&& ISynoptic.YYGGI_SUB_W.matcher(element).find()) {
|
||||
try {
|
||||
Integer month = getHeader().getMonth();
|
||||
if (month != -1) {
|
||||
|
@ -222,7 +223,7 @@ public class SHIPSynopticDecoder extends AbstractSynopticDecoder {
|
|||
reportParser.next();
|
||||
String element = reportParser.getElement();
|
||||
|
||||
if (LAT_PATTERN.matcher(element).find()) {
|
||||
if (element != null && LAT_PATTERN.matcher(element).find()) {
|
||||
Integer lat = getInt(element, 2, 5);
|
||||
if ((lat != null) && (lat >= 0)) {
|
||||
shipLatitude = lat.floatValue() / 10.0f;
|
||||
|
@ -240,7 +241,7 @@ public class SHIPSynopticDecoder extends AbstractSynopticDecoder {
|
|||
reportParser.next();
|
||||
String element = reportParser.getElement();
|
||||
|
||||
if (LON_PATTERN.matcher(element).find()) {
|
||||
if (element != null && LON_PATTERN.matcher(element).find()) {
|
||||
Integer lon = getInt(element, 1, 5);
|
||||
if ((lon != null) && (lon >= 0)) {
|
||||
shipLongitude = lon.floatValue() / 10.0f;
|
||||
|
|
|
@ -95,7 +95,7 @@ public class SynopticGroups {
|
|||
int lookingForSect) {
|
||||
DataItem decodedItem = null;
|
||||
|
||||
if (HUMIDITY_PATTERN.matcher(groupData).find()) {
|
||||
if (groupData != null && HUMIDITY_PATTERN.matcher(groupData).find()) {
|
||||
Integer val = Integer.parseInt(groupData.substring(2, 5));
|
||||
if ((val != null) && (val >= 0)) {
|
||||
if (lookingForSect == 1) {
|
||||
|
|
|
@ -91,7 +91,8 @@ public class SynopticSec4Decoder extends AbstractSectionDecoder {
|
|||
|
||||
if (reportParser.next()) {
|
||||
String element = reportParser.getElement();
|
||||
if (ISynoptic.GENERAL_GROUP.matcher(element).find()) {
|
||||
if (element != null
|
||||
&& ISynoptic.GENERAL_GROUP.matcher(element).find()) {
|
||||
cloudAmount = AbstractSfcObsDecoder.getInt(element, 0, 1);
|
||||
cloudGenus = AbstractSfcObsDecoder.getInt(element, 1, 2);
|
||||
cloudAltitude = AbstractSfcObsDecoder.getInt(element, 2, 4);
|
||||
|
|
Loading…
Add table
Reference in a new issue