mirror of
https://github.com/lightbend/config.git
synced 2025-03-28 13:01:09 +08:00
- revert changes to ConfigValueType of numbers beginning with '.'
This commit is contained in:
parent
2e71d57e61
commit
93083e86ef
config/src
@ -295,7 +295,7 @@ final class Tokenizer {
|
||||
}
|
||||
|
||||
// chars JSON allows a number to start with
|
||||
static final String firstNumberChars = "0123456789-.";
|
||||
static final String firstNumberChars = "0123456789-";
|
||||
// chars JSON allows to be part of a number
|
||||
static final String numberChars = "0123456789eE+-.";
|
||||
// chars that stop an unquoted string
|
||||
@ -350,7 +350,7 @@ final class Tokenizer {
|
||||
private Token pullNumber(int firstChar) throws ProblemException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.appendCodePoint(firstChar);
|
||||
boolean containedDecimalOrE = firstChar == '.';
|
||||
boolean containedDecimalOrE = false;
|
||||
int c = nextCharRaw();
|
||||
while (c != -1 && numberChars.indexOf(c) >= 0) {
|
||||
if (c == '.' || c == 'e' || c == 'E')
|
||||
|
@ -606,8 +606,8 @@ class ConfigTest extends TestUtils {
|
||||
assertEquals(Seq(intValue(1), intValue(2), intValue(3)), conf.getList("arrays.ofInt").asScala)
|
||||
assertEquals(Seq(stringValue("a"), stringValue("b"), stringValue("c")), conf.getList("arrays.ofString").asScala)
|
||||
|
||||
// make sure floats starting with a '.' are parsed as numbers
|
||||
assertEquals(ConfigValueType.NUMBER, conf.getValue("floats.pointThirtyThree").valueType())
|
||||
// make sure floats starting with a '.' are parsed as strings (they will be converted to double on demand)
|
||||
assertEquals(ConfigValueType.STRING, conf.getValue("floats.pointThirtyThree").valueType())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user