diff --git a/csv/src/main/java/tools/jackson/dataformat/csv/CsvParser.java b/csv/src/main/java/tools/jackson/dataformat/csv/CsvParser.java index 686957e4..16831cc3 100644 --- a/csv/src/main/java/tools/jackson/dataformat/csv/CsvParser.java +++ b/csv/src/main/java/tools/jackson/dataformat/csv/CsvParser.java @@ -539,7 +539,7 @@ public String nextName() throws JacksonException } @Override - public String nextTextValue() throws JacksonException + public String nextStringValue() throws JacksonException { _binaryValue = null; JsonToken t; @@ -556,7 +556,7 @@ public String nextTextValue() throws JacksonException } else { t = nextToken(); if (t == JsonToken.VALUE_STRING) { - return getText(); + return getString(); } } return null; @@ -975,7 +975,7 @@ protected final JsonToken _skipUntilEndOfLine() throws JacksonException // For now we do not store char[] representation... @Override - public boolean hasTextCharacters() { + public boolean hasStringCharacters() { if (_currToken == JsonToken.PROPERTY_NAME) { return false; } @@ -983,7 +983,7 @@ public boolean hasTextCharacters() { } @Override - public String getText() throws JacksonException { + public String getString() throws JacksonException { if (_currToken == JsonToken.PROPERTY_NAME) { return _currentName; } @@ -993,7 +993,7 @@ public String getText() throws JacksonException { } @Override - public char[] getTextCharacters() throws JacksonException { + public char[] getStringCharacters() throws JacksonException { if (_currToken == JsonToken.PROPERTY_NAME) { return _currentName.toCharArray(); } @@ -1001,7 +1001,7 @@ public char[] getTextCharacters() throws JacksonException { } @Override - public int getTextLength() throws JacksonException { + public int getStringLength() throws JacksonException { if (_currToken == JsonToken.PROPERTY_NAME) { return _currentName.length(); } @@ -1009,12 +1009,12 @@ public int getTextLength() throws JacksonException { } @Override - public int getTextOffset() throws JacksonException { + public int getStringOffset() throws JacksonException { return 0; } @Override - public int getText(Writer w) throws JacksonException { + public int getString(Writer w) throws JacksonException { String value = (_currToken == JsonToken.PROPERTY_NAME) ? _currentName : _currentValue; if (value == null) { diff --git a/csv/src/test/java/tools/jackson/dataformat/csv/ModuleTestBase.java b/csv/src/test/java/tools/jackson/dataformat/csv/ModuleTestBase.java index 859231cf..b0ea747a 100644 --- a/csv/src/test/java/tools/jackson/dataformat/csv/ModuleTestBase.java +++ b/csv/src/test/java/tools/jackson/dataformat/csv/ModuleTestBase.java @@ -276,10 +276,10 @@ protected void assertType(Object ob, Class expType) protected String getAndVerifyText(JsonParser jp) { // Ok, let's verify other accessors - int actLen = jp.getTextLength(); - char[] ch = jp.getTextCharacters(); - String str2 = new String(ch, jp.getTextOffset(), actLen); - String str = jp.getText(); + int actLen = jp.getStringLength(); + char[] ch = jp.getStringCharacters(); + String str2 = new String(ch, jp.getStringOffset(), actLen); + String str = jp.getString(); if (str.length() != actLen) { fail("Internal problem (jp.token == "+jp.currentToken()+"): jp.getText().length() ['"+str+"'] == "+str.length()+"; jp.getTextLength() == "+actLen); @@ -291,14 +291,14 @@ protected String getAndVerifyText(JsonParser jp) protected void verifyFieldName(JsonParser p, String expName) { - assertEquals(expName, p.getText()); + assertEquals(expName, p.getString()); assertEquals(expName, p.currentName()); } protected void verifyIntValue(JsonParser jp, long expValue) { // First, via textual - assertEquals(String.valueOf(expValue), jp.getText()); + assertEquals(String.valueOf(expValue), jp.getString()); } protected void verifyException(Throwable e, String... matches) diff --git a/csv/src/test/java/tools/jackson/dataformat/csv/deser/BrokenEncodingTest.java b/csv/src/test/java/tools/jackson/dataformat/csv/deser/BrokenEncodingTest.java index ec6917bc..80483c69 100644 --- a/csv/src/test/java/tools/jackson/dataformat/csv/deser/BrokenEncodingTest.java +++ b/csv/src/test/java/tools/jackson/dataformat/csv/deser/BrokenEncodingTest.java @@ -37,7 +37,7 @@ public void testLatin1AsUTF8() throws Exception assertToken(JsonToken.VALUE_STRING, parser.nextToken()); assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); assertToken(JsonToken.VALUE_STRING, parser.nextToken()); - assertEquals("2", parser.getText()); + assertEquals("2", parser.getString()); assertToken(JsonToken.END_OBJECT, parser.nextToken()); // problem should only be triggered now @@ -45,7 +45,7 @@ public void testLatin1AsUTF8() throws Exception assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); assertEquals("a", parser.currentName()); assertToken(JsonToken.VALUE_STRING, parser.nextToken()); - assertEquals("abc", parser.getText()); + assertEquals("abc", parser.getString()); try { parser.nextToken(); fail("Should trigger exception for invalid UTF-8 char"); @@ -77,7 +77,7 @@ public void testBrokenUTF8MiddleByte() throws Exception assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); assertEquals("a", parser.currentName()); assertToken(JsonToken.VALUE_STRING, parser.nextToken()); - assertEquals("1", parser.getText()); + assertEquals("1", parser.getString()); try { assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); assertEquals("b", parser.currentName()); diff --git a/csv/src/test/java/tools/jackson/dataformat/csv/deser/StreamingCSVReadTest.java b/csv/src/test/java/tools/jackson/dataformat/csv/deser/StreamingCSVReadTest.java index 25fdd5de..e63cb5d4 100644 --- a/csv/src/test/java/tools/jackson/dataformat/csv/deser/StreamingCSVReadTest.java +++ b/csv/src/test/java/tools/jackson/dataformat/csv/deser/StreamingCSVReadTest.java @@ -79,23 +79,23 @@ private void _testInts(boolean useBytes, int a, int b, int c) throws Exception { assertEquals("a", parser.currentName()); StringWriter w = new StringWriter(); - assertEquals(1, parser.getText(w)); + assertEquals(1, parser.getString(w)); assertEquals("a", w.toString()); String numStr = String.valueOf(a); - assertEquals(numStr, parser.nextTextValue()); - char[] ch = parser.getTextCharacters(); - String str2 = new String(ch, parser.getTextOffset(), parser.getTextLength()); + assertEquals(numStr, parser.nextStringValue()); + char[] ch = parser.getStringCharacters(); + String str2 = new String(ch, parser.getStringOffset(), parser.getStringLength()); assertEquals(numStr, str2); w = new StringWriter(); - assertEquals(numStr.length(), parser.getText(w)); + assertEquals(numStr.length(), parser.getString(w)); assertEquals(numStr, w.toString()); assertEquals(a, parser.getIntValue()); assertEquals((long) a, parser.getLongValue()); assertEquals("b", parser.nextName()); - assertEquals(""+b, parser.nextTextValue()); + assertEquals(""+b, parser.nextStringValue()); assertEquals((long) b, parser.getLongValue()); assertEquals(b, parser.getIntValue()); @@ -151,11 +151,11 @@ private void _testLongs(boolean useBytes, long a, long b) throws Exception assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); assertEquals("a", parser.currentName()); - assertEquals(""+a, parser.nextTextValue()); + assertEquals(""+a, parser.nextStringValue()); assertEquals(a, parser.getLongValue()); assertEquals("b", parser.nextName()); - assertEquals(""+b, parser.nextTextValue()); + assertEquals(""+b, parser.nextStringValue()); assertEquals(b, parser.getLongValue()); assertToken(JsonToken.END_OBJECT, parser.nextToken()); @@ -173,12 +173,12 @@ private void _testDoubles(boolean useBytes, double a, double b, double c) assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); assertEquals("a", parser.currentName()); - assertEquals(""+a, parser.nextTextValue()); + assertEquals(""+a, parser.nextStringValue()); assertEquals(a, parser.getDoubleValue()); assertEquals((float) a, parser.getFloatValue()); assertEquals("b", parser.nextName()); - assertEquals(""+b, parser.nextTextValue()); + assertEquals(""+b, parser.nextStringValue()); assertEquals((float) b, parser.getFloatValue()); assertEquals(b, parser.getDoubleValue()); diff --git a/properties/src/main/java/tools/jackson/dataformat/javaprop/JavaPropsParser.java b/properties/src/main/java/tools/jackson/dataformat/javaprop/JavaPropsParser.java index e6f8b59b..4bae5a58 100644 --- a/properties/src/main/java/tools/jackson/dataformat/javaprop/JavaPropsParser.java +++ b/properties/src/main/java/tools/jackson/dataformat/javaprop/JavaPropsParser.java @@ -211,7 +211,7 @@ public JsonToken nextToken() throws JacksonException { } @Override - public String getText() throws JacksonException { + public String getString() throws JacksonException { JsonToken t = _currToken; if (t == JsonToken.VALUE_STRING) { return _streamReadContext.getCurrentText(); @@ -224,31 +224,31 @@ public String getText() throws JacksonException { } @Override - public boolean hasTextCharacters() { + public boolean hasStringCharacters() { return false; } @Override - public char[] getTextCharacters() throws JacksonException { - String text = getText(); + public char[] getStringCharacters() throws JacksonException { + String text = getString(); return (text == null) ? null : text.toCharArray(); } @Override - public int getTextLength() throws JacksonException { - String text = getText(); + public int getStringLength() throws JacksonException { + String text = getString(); return (text == null) ? 0 : text.length(); } @Override - public int getTextOffset() throws JacksonException { + public int getStringOffset() throws JacksonException { return 0; } @Override - public int getText(Writer writer) throws JacksonException + public int getString(Writer writer) throws JacksonException { - String str = getText(); + String str = getString(); if (str == null) { return 0; } @@ -269,7 +269,7 @@ public byte[] getBinaryValue(Base64Variant variant) throws JacksonException _reportError("Current token ("+_currToken+") not VALUE_STRING, can not access as binary"); } ByteArrayBuilder builder = _getByteArrayBuilder(); - _decodeBase64(getText(), builder, variant); + _decodeBase64(getString(), builder, variant); _binaryValue = builder.toByteArray(); } return _binaryValue; diff --git a/properties/src/test/java/tools/jackson/dataformat/javaprop/DefaultConfigsTest.java b/properties/src/test/java/tools/jackson/dataformat/javaprop/DefaultConfigsTest.java index bb0b2ea8..72f9ddc8 100644 --- a/properties/src/test/java/tools/jackson/dataformat/javaprop/DefaultConfigsTest.java +++ b/properties/src/test/java/tools/jackson/dataformat/javaprop/DefaultConfigsTest.java @@ -44,7 +44,7 @@ public void testParserConfig() throws Exception _verifyVersion(p); assertFalse(p.canReadObjectId()); assertFalse(p.canReadTypeId()); - assertFalse(p.hasTextCharacters()); + assertFalse(p.hasStringCharacters()); p.close(); } diff --git a/properties/src/test/java/tools/jackson/dataformat/javaprop/ModuleTestBase.java b/properties/src/test/java/tools/jackson/dataformat/javaprop/ModuleTestBase.java index 095ebc0d..29f2ff2c 100644 --- a/properties/src/test/java/tools/jackson/dataformat/javaprop/ModuleTestBase.java +++ b/properties/src/test/java/tools/jackson/dataformat/javaprop/ModuleTestBase.java @@ -219,10 +219,10 @@ protected void assertType(Object ob, Class expType) protected String getAndVerifyText(JsonParser jp) throws IOException { // Ok, let's verify other accessors - int actLen = jp.getTextLength(); - char[] ch = jp.getTextCharacters(); - String str2 = new String(ch, jp.getTextOffset(), actLen); - String str = jp.getText(); + int actLen = jp.getStringLength(); + char[] ch = jp.getStringCharacters(); + String str2 = new String(ch, jp.getStringOffset(), actLen); + String str = jp.getString(); if (str.length() != actLen) { fail("Internal problem (jp.token == "+jp.currentToken()+"): jp.getText().length() ['"+str+"'] == "+str.length()+"; jp.getTextLength() == "+actLen); @@ -235,7 +235,7 @@ protected String getAndVerifyText(JsonParser jp) throws IOException protected void verifyFieldName(JsonParser p, String expName) throws IOException { - assertEquals(expName, p.getText()); + assertEquals(expName, p.getString()); assertEquals(expName, p.currentName()); } @@ -243,7 +243,7 @@ protected void verifyIntValue(JsonParser jp, long expValue) throws IOException { // First, via textual - assertEquals(String.valueOf(expValue), jp.getText()); + assertEquals(String.valueOf(expValue), jp.getString()); } protected void verifyException(Throwable e, String... matches) diff --git a/properties/src/test/java/tools/jackson/dataformat/javaprop/SimpleStreamingTest.java b/properties/src/test/java/tools/jackson/dataformat/javaprop/SimpleStreamingTest.java index 81756ec9..5496a50d 100644 --- a/properties/src/test/java/tools/jackson/dataformat/javaprop/SimpleStreamingTest.java +++ b/properties/src/test/java/tools/jackson/dataformat/javaprop/SimpleStreamingTest.java @@ -31,10 +31,10 @@ public void testParsing() assertNotNull(p.currentLocation()); // N/A assertNotNull(p.currentTokenLocation()); // N/A assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("foo", p.getText()); + assertEquals("foo", p.getString()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); StringWriter sw = new StringWriter(); - assertEquals(3, p.getText(sw)); + assertEquals(3, p.getString(sw)); assertEquals("bar", sw.toString()); p.close(); assertTrue(p.isClosed()); @@ -43,7 +43,7 @@ public void testParsing() p = MAPPER.createParser("foo = bar"); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertEquals("foo", p.nextName()); - assertEquals("bar", p.nextTextValue()); + assertEquals("bar", p.nextStringValue()); assertNull(p.nextName()); p.close(); diff --git a/yaml/src/main/java/tools/jackson/dataformat/yaml/YAMLParser.java b/yaml/src/main/java/tools/jackson/dataformat/yaml/YAMLParser.java index b8fcdc37..e98a1982 100644 --- a/yaml/src/main/java/tools/jackson/dataformat/yaml/YAMLParser.java +++ b/yaml/src/main/java/tools/jackson/dataformat/yaml/YAMLParser.java @@ -785,12 +785,12 @@ private T _reportInvalidNumber(String numStr, int base, Exception e) throws // For now we do not store char[] representation... @Override - public boolean hasTextCharacters() { + public boolean hasStringCharacters() { return false; } @Override - public String getText() throws JacksonException + public String getString() throws JacksonException { if (_currToken == JsonToken.VALUE_STRING) { return _textValue; @@ -823,26 +823,26 @@ public String currentName() throws JacksonException } @Override - public char[] getTextCharacters() throws JacksonException { - String text = getText(); + public char[] getStringCharacters() throws JacksonException { + String text = getString(); return (text == null) ? null : text.toCharArray(); } @Override - public int getTextLength() throws JacksonException { - String text = getText(); + public int getStringLength() throws JacksonException { + String text = getString(); return (text == null) ? 0 : text.length(); } @Override - public int getTextOffset() throws JacksonException { + public int getStringOffset() throws JacksonException { return 0; } @Override - public int getText(Writer writer) throws JacksonException + public int getString(Writer writer) throws JacksonException { - String str = getText(); + String str = getString(); if (str == null) { return 0; } diff --git a/yaml/src/test/java/perf/MediaItem.java b/yaml/src/test/java/perf/MediaItem.java index 625abb5c..37bbaead 100644 --- a/yaml/src/test/java/perf/MediaItem.java +++ b/yaml/src/test/java/perf/MediaItem.java @@ -176,10 +176,10 @@ public static Photo deserialize(JsonParser p) throws IOException if (I != null) { switch (I.intValue()) { case F_URI: - photo.setUri(p.getText()); + photo.setUri(p.getString()); continue; case F_TITLE: - photo.setTitle(p.getText()); + photo.setTitle(p.getString()); continue; case F_WIDTH: photo.setWidth(p.getIntValue()); @@ -188,7 +188,7 @@ public static Photo deserialize(JsonParser p) throws IOException photo.setHeight(p.getIntValue()); continue; case F_SIZE: - photo.setSize(findSize(p.getText())); + photo.setSize(findSize(p.getString())); continue; } } @@ -312,12 +312,12 @@ public static Content deserialize(JsonParser p) throws IOException if (I != null) { switch (I.intValue()) { case F_PLAYER: - content.setPlayer(findPlayer(p.getText())); + content.setPlayer(findPlayer(p.getString())); case F_URI: - content.setUri(p.getText()); + content.setUri(p.getString()); continue; case F_TITLE: - content.setTitle(p.getText()); + content.setTitle(p.getString()); continue; case F_WIDTH: content.setWidth(p.getIntValue()); @@ -326,7 +326,7 @@ public static Content deserialize(JsonParser p) throws IOException content.setHeight(p.getIntValue()); continue; case F_FORMAT: - content.setCopyright(p.getText()); + content.setCopyright(p.getString()); continue; case F_DURATION: content.setDuration(p.getLongValue()); @@ -341,7 +341,7 @@ public static Content deserialize(JsonParser p) throws IOException content.setPersons(deserializePersons(p)); continue; case F_COPYRIGHT: - content.setCopyright(p.getText()); + content.setCopyright(p.getString()); continue; } } @@ -360,7 +360,7 @@ private static List deserializePersons(JsonParser p) throws IOException } ArrayList persons = new ArrayList(4); while (p.nextToken() == JsonToken.VALUE_STRING) { - persons.add(p.getText()); + persons.add(p.getString()); } if (p.currentToken() != JsonToken.END_ARRAY) { throw new IOException("Need END_ARRAY to complete List of Persons"); diff --git a/yaml/src/test/java/tools/jackson/dataformat/yaml/ModuleTestBase.java b/yaml/src/test/java/tools/jackson/dataformat/yaml/ModuleTestBase.java index d07af933..947ff54b 100644 --- a/yaml/src/test/java/tools/jackson/dataformat/yaml/ModuleTestBase.java +++ b/yaml/src/test/java/tools/jackson/dataformat/yaml/ModuleTestBase.java @@ -142,10 +142,10 @@ protected void assertYAML(String expOrig, String actOrig) protected String getAndVerifyText(JsonParser jp) { // Ok, let's verify other accessors - int actLen = jp.getTextLength(); - char[] ch = jp.getTextCharacters(); - String str2 = new String(ch, jp.getTextOffset(), actLen); - String str = jp.getText(); + int actLen = jp.getStringLength(); + char[] ch = jp.getStringCharacters(); + String str2 = new String(ch, jp.getStringOffset(), actLen); + String str = jp.getString(); if (str.length() != actLen) { fail("Internal problem (jp.token == "+jp.currentToken()+"): jp.getText().length() ['"+str+"'] == "+str.length()+"; jp.getTextLength() == "+actLen); @@ -157,14 +157,14 @@ protected String getAndVerifyText(JsonParser jp) protected void verifyFieldName(JsonParser p, String expName) { - assertEquals(expName, p.getText()); + assertEquals(expName, p.getString()); assertEquals(expName, p.currentName()); } protected void verifyIntValue(JsonParser jp, long expValue) { // First, via textual - assertEquals(String.valueOf(expValue), jp.getText()); + assertEquals(String.valueOf(expValue), jp.getString()); } protected void verifyException(Throwable e, String... matches) diff --git a/yaml/src/test/java/tools/jackson/dataformat/yaml/MultipleDocumentsReadTest.java b/yaml/src/test/java/tools/jackson/dataformat/yaml/MultipleDocumentsReadTest.java index a61bfdca..4ef94886 100644 --- a/yaml/src/test/java/tools/jackson/dataformat/yaml/MultipleDocumentsReadTest.java +++ b/yaml/src/test/java/tools/jackson/dataformat/yaml/MultipleDocumentsReadTest.java @@ -24,7 +24,7 @@ public void testMultipleDocumentsViaParser() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(42, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("42", p.getText()); + assertEquals("42", p.getString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); @@ -32,7 +32,7 @@ public void testMultipleDocumentsViaParser() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(-42, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("-42", p.getText()); + assertEquals("-42", p.getString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); p.close(); } diff --git a/yaml/src/test/java/tools/jackson/dataformat/yaml/deser/StreamingYAMLParseTest.java b/yaml/src/test/java/tools/jackson/dataformat/yaml/deser/StreamingYAMLParseTest.java index 676581eb..b95422d8 100644 --- a/yaml/src/test/java/tools/jackson/dataformat/yaml/deser/StreamingYAMLParseTest.java +++ b/yaml/src/test/java/tools/jackson/dataformat/yaml/deser/StreamingYAMLParseTest.java @@ -37,7 +37,7 @@ public void testBasic() throws Exception assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("text", p.getText()); + assertEquals("text", p.getString()); TokenStreamLocation loc = p.currentTokenLocation(); assertEquals(1, loc.getLineNr()); assertEquals(9, loc.getColumnNr()); @@ -46,7 +46,7 @@ public void testBasic() throws Exception assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertEquals("true", p.getText()); + assertEquals("true", p.getString()); loc = p.currentTokenLocation(); assertEquals(2, loc.getLineNr()); assertEquals(7, loc.getColumnNr()); @@ -55,17 +55,17 @@ public void testBasic() throws Exception assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); - assertEquals("false", p.getText()); + assertEquals("false", p.getString()); assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertEquals("null", p.getText()); + assertEquals("null", p.getString()); assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals("123", p.getText()); + assertEquals("123", p.getString()); assertEquals(123, p.getIntValue()); assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); - assertEquals("1.25", p.getText()); + assertEquals("1.25", p.getString()); assertEquals(1.25, p.getDoubleValue()); assertEquals(1, p.getIntValue()); @@ -91,7 +91,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MAX_VALUE, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("2147483647", p.getText()); + assertEquals("2147483647", p.getString()); p.close(); // Test negative max-int @@ -103,7 +103,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MIN_VALUE, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("-2147483648", p.getText()); + assertEquals("-2147483648", p.getString()); p.close(); // Test positive max-int + 1 @@ -115,7 +115,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MAX_VALUE + 1L, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("2147483648", p.getText()); + assertEquals("2147483648", p.getString()); p.close(); // Test negative max-int - 1 @@ -127,7 +127,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MIN_VALUE - 1L, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("-2147483649", p.getText()); + assertEquals("-2147483649", p.getString()); p.close(); // Test positive max-long @@ -139,7 +139,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Long.MAX_VALUE, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("9223372036854775807", p.getText()); + assertEquals("9223372036854775807", p.getString()); p.close(); // Test negative max-long @@ -151,7 +151,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Long.MIN_VALUE, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("-9223372036854775808", p.getText()); + assertEquals("-9223372036854775808", p.getString()); p.close(); // Test positive max-long + 1 @@ -163,7 +163,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE), p.getBigIntegerValue()); assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType()); - assertEquals("9223372036854775808", p.getText()); + assertEquals("9223372036854775808", p.getString()); p.close(); // Test negative max-long - 1 @@ -175,7 +175,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.ONE), p.getBigIntegerValue()); assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType()); - assertEquals("-9223372036854775809", p.getText()); + assertEquals("-9223372036854775809", p.getString()); p.close(); } @@ -190,7 +190,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(10345, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("10_345", p.getText()); + assertEquals("10_345", p.getString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); } @@ -201,7 +201,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(-11222, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("-11_222", p.getText()); + assertEquals("-11_222", p.getString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); } @@ -212,7 +212,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(8192, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("+8_192", p.getText()); + assertEquals("+8_192", p.getString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); } @@ -228,7 +228,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MAX_VALUE, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("2_147_483_647", p.getText()); + assertEquals("2_147_483_647", p.getString()); p.close(); // Test negative max-int @@ -240,7 +240,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MIN_VALUE, p.getIntValue()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - assertEquals("-2_147_483_648", p.getText()); + assertEquals("-2_147_483_648", p.getString()); p.close(); // Test positive max-int + 1 @@ -252,7 +252,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MAX_VALUE + 1L, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("2_147_483_648", p.getText()); + assertEquals("2_147_483_648", p.getString()); p.close(); // Test negative max-int - 1 @@ -264,7 +264,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Integer.MIN_VALUE - 1L, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("-2_147_483_649", p.getText()); + assertEquals("-2_147_483_649", p.getString()); p.close(); // Test positive max-long @@ -276,7 +276,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Long.MAX_VALUE, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("9_223_372_036_854_775_807", p.getText()); + assertEquals("9_223_372_036_854_775_807", p.getString()); p.close(); // Test negative max-long @@ -288,7 +288,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(Long.MIN_VALUE, p.getLongValue()); assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - assertEquals("-9_223_372_036_854_775_808", p.getText()); + assertEquals("-9_223_372_036_854_775_808", p.getString()); p.close(); // Test positive max-long + 1 @@ -300,7 +300,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE), p.getBigIntegerValue()); assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType()); - assertEquals("9_223372036854775_808", p.getText()); + assertEquals("9_223372036854775_808", p.getString()); p.close(); // Test negative max-long - 1 @@ -312,7 +312,7 @@ public void testIntParsingWithLimits() throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.ONE), p.getBigIntegerValue()); assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType()); - assertEquals("-92233_72036_85477_5809", p.getText()); + assertEquals("-92233_72036_85477_5809", p.getString()); p.close(); } @@ -346,12 +346,12 @@ public void testDoubleParsing() throws Exception assertEquals("num", p.currentName()); StringWriter w = new StringWriter(); - assertEquals(3, p.getText(w)); + assertEquals(3, p.getString(w)); assertEquals("num", w.toString()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); // let's retain exact representation text however: - assertEquals("+1000.25", p.getText()); + assertEquals("+1000.25", p.getString()); p.close(); // and then non-number that may be mistaken @@ -366,10 +366,10 @@ public void testDoubleParsing() throws Exception assertToken(JsonToken.VALUE_STRING, p.nextToken()); w = new StringWriter(); - assertEquals(IP.length(), p.getText(w)); + assertEquals(IP.length(), p.getString(w)); assertEquals(IP, w.toString()); - assertEquals(IP, p.getText()); + assertEquals(IP, p.getString()); p.close(); } @@ -389,7 +389,7 @@ public void testColons() throws Exception assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertEquals("text", p.currentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("foo:bar", p.getText()); + assertEquals("foo:bar", p.getString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertNull(p.nextToken()); @@ -427,7 +427,7 @@ public void testAnchorParsing() throws Exception assertToken(JsonToken.PROPERTY_NAME, yp.nextToken()); assertEquals("name", yp.currentName()); assertToken(JsonToken.VALUE_STRING, yp.nextToken()); - assertEquals("Bob", yp.getText()); + assertEquals("Bob", yp.getString()); assertFalse(yp.isCurrentAlias()); assertToken(JsonToken.END_OBJECT, yp.nextToken()); @@ -440,11 +440,11 @@ public void testAnchorParsing() throws Exception assertToken(JsonToken.PROPERTY_NAME, yp.nextToken()); assertEquals("name", yp.currentName()); assertToken(JsonToken.VALUE_STRING, yp.nextToken()); - assertEquals("Bill", yp.getText()); + assertEquals("Bill", yp.getString()); assertToken(JsonToken.PROPERTY_NAME, yp.nextToken()); assertEquals("parentRef", yp.currentName()); assertToken(JsonToken.VALUE_STRING, yp.nextToken()); - assertEquals("id1", yp.getText()); + assertEquals("id1", yp.getString()); assertTrue(yp.isCurrentAlias()); assertToken(JsonToken.END_OBJECT, yp.nextToken()); @@ -466,10 +466,10 @@ public void testQuotedStyles() throws Exception assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(0, p.streamReadContext().getCurrentIndex()); - assertEquals("true", p.getText()); + assertEquals("true", p.getString()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(1, p.streamReadContext().getCurrentIndex()); - assertEquals("false", p.getText()); + assertEquals("false", p.getString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertNull(p.nextToken()); @@ -540,10 +540,10 @@ public void testObjectWithNumbers() throws Exception assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(0, p.streamReadContext().getCurrentIndex()); - assertEquals("Foo Bar", p.getText()); + assertEquals("Foo Bar", p.getString()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(1, p.streamReadContext().getCurrentIndex()); - assertEquals("Max Power", p.getText()); + assertEquals("Max Power", p.getString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -600,7 +600,7 @@ public void testTimeLikeValues() throws Exception assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); assertEquals("value", p.currentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("3:00", p.getText()); + assertEquals("3:00", p.getString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertNull(p.nextToken()); p.close(); diff --git a/yaml/src/test/java/tools/jackson/dataformat/yaml/failing/UnicodeYAMLRead497Test.java b/yaml/src/test/java/tools/jackson/dataformat/yaml/failing/UnicodeYAMLRead497Test.java index e89cea97..2fe8d54a 100644 --- a/yaml/src/test/java/tools/jackson/dataformat/yaml/failing/UnicodeYAMLRead497Test.java +++ b/yaml/src/test/java/tools/jackson/dataformat/yaml/failing/UnicodeYAMLRead497Test.java @@ -41,7 +41,7 @@ void _testUnicodeAtEnd(int LEN) throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); assertEquals("key", p.nextName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals(valueBuffer.toString(), p.getText()); + assertEquals(valueBuffer.toString(), p.getString()); } } }