]> granicus.if.org Git - icu/commitdiff
ICU-13461 Fixing coverity defects in new number parsing code.
authorShane Carr <shane@unicode.org>
Sat, 3 Feb 2018 07:48:29 +0000 (07:48 +0000)
committerShane Carr <shane@unicode.org>
Sat, 3 Feb 2018 07:48:29 +0000 (07:48 +0000)
X-SVN-Rev: 40834

icu4j/main/classes/core/src/com/ibm/icu/impl/number/parse/DecimalMatcher.java
icu4j/main/classes/core/src/com/ibm/icu/impl/number/parse/NumberParserImpl.java

index 4a12af11c2069faa78e7c38b6403ffba6825463c..7c5ab7994fe7982b6923f6162aca1d84b3af4336 100644 (file)
@@ -304,6 +304,7 @@ public class DecimalMatcher implements NumberParseMatcher {
         }
 
         if (isScientific && segment.getOffset() != initialOffset) {
+            assert result.quantity != null; // scientific notation always comes after the number
             boolean overflow = (exponent == Integer.MAX_VALUE);
             if (!overflow) {
                 try {
index 73654686dbb752aef2084bc258fec9400e8170b8..12b9a0535c74fb54d1dcf1a22cf57cc24e34d482 100644 (file)
@@ -9,7 +9,6 @@ import java.util.Comparator;
 import java.util.List;
 
 import com.ibm.icu.impl.number.AffixPatternProvider;
-import com.ibm.icu.impl.number.AffixUtils;
 import com.ibm.icu.impl.number.CustomSymbolCurrency;
 import com.ibm.icu.impl.number.DecimalFormatProperties;
 import com.ibm.icu.impl.number.PatternStringParser;
@@ -225,11 +224,7 @@ public class NumberParserImpl {
         ///////////////////////////////
 
         if (!isStrict) {
-            if (!isStrict
-                    || patternInfo.containsSymbolType(AffixUtils.TYPE_PLUS_SIGN)
-                    || properties.getSignAlwaysShown()) {
-                parser.addMatcher(PlusSignMatcher.getInstance(symbols, false));
-            }
+            parser.addMatcher(PlusSignMatcher.getInstance(symbols, false));
             parser.addMatcher(MinusSignMatcher.getInstance(symbols, false));
             parser.addMatcher(NanMatcher.getInstance(symbols, parseFlags));
             parser.addMatcher(PercentMatcher.getInstance(symbols));