From 52315f99445c347b421dcae6a4c977d79d756b6a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 27 Jul 2014 08:16:18 +0200 Subject: Fix regex pattern (fix #784) --- src/org/traccar/protocol/MeitrackProtocolDecoder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 9e30b885a..490d44226 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -61,7 +61,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { "(\\d+\\|\\d+\\|\\p{XDigit}+\\|\\p{XDigit}+)," + // Cell "(\\p{XDigit}+)," + // State "(\\p{XDigit}+)\\|" + // ADC1 - "(\\p{XDigit}+)\\|" + // ADC2 + "(\\p{XDigit}+)?\\|" + // ADC2 "(\\p{XDigit}+)?\\|" + // ADC3 "(\\p{XDigit}+)\\|" + // Battery "(\\p{XDigit}+)," + // Power @@ -138,7 +138,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { // ADC extendedInfo.set("adc1", Integer.parseInt(parser.group(index++), 16)); - extendedInfo.set("adc2", Integer.parseInt(parser.group(index++), 16)); + String adc2 = parser.group(index++); + if (adc2 != null) { + extendedInfo.set("adc2", Integer.parseInt(adc2, 16)); + } String adc3 = parser.group(index++); if (adc3 != null) { extendedInfo.set("adc3", Integer.parseInt(adc3, 16)); -- cgit v1.2.3