From 260557ac72219d3e61b1161b08f8669bb12fddde Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Thu, 2 Jan 2025 19:08:37 -0800 Subject: [PATCH] Fix wrt [core#1378] --- .../AnnotationBasedValueRWModifier.java | 2 +- .../javatime/LocalDateTimeValueReader.java | 2 +- .../java/tools/jackson/jr/ob/impl/AnyReader.java | 4 ++-- .../java/tools/jackson/jr/ob/impl/BeanReader.java | 4 ++-- .../java/tools/jackson/jr/ob/impl/EnumReader.java | 2 +- .../jackson/jr/ob/impl/SimpleValueReader.java | 4 ++-- .../jackson/jr/ob/impl/CustomValueReadersTest.java | 4 ++-- .../jr/ob/impl/ValueReaderModifierTest.java | 2 +- .../jackson/jr/stree/JacksonJrsTreeCodec.java | 2 +- .../jr/stree/util/JrsTreeTraversingParser.java | 14 +++++++------- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/jr-annotation-support/src/main/java/tools/jackson/jr/annotationsupport/AnnotationBasedValueRWModifier.java b/jr-annotation-support/src/main/java/tools/jackson/jr/annotationsupport/AnnotationBasedValueRWModifier.java index 48db6650..ede4a865 100644 --- a/jr-annotation-support/src/main/java/tools/jackson/jr/annotationsupport/AnnotationBasedValueRWModifier.java +++ b/jr-annotation-support/src/main/java/tools/jackson/jr/annotationsupport/AnnotationBasedValueRWModifier.java @@ -204,7 +204,7 @@ private EnumJsonCreatorReader(Class valueType, Method jsonCreatorMethod) { public Object read(JSONReader reader, JsonParser p) throws JacksonException { try { - return _jsonCreatorMethod.invoke(_valueType, p.getText()); + return _jsonCreatorMethod.invoke(_valueType, p.getString()); } catch (Exception e) { throw new JSONObjectException("Cannot call JsonCreator method", e); } diff --git a/jr-extension-javatime/src/main/java/tools/jackson/jr/extension/javatime/LocalDateTimeValueReader.java b/jr-extension-javatime/src/main/java/tools/jackson/jr/extension/javatime/LocalDateTimeValueReader.java index 3781c527..3dde79f7 100644 --- a/jr-extension-javatime/src/main/java/tools/jackson/jr/extension/javatime/LocalDateTimeValueReader.java +++ b/jr-extension-javatime/src/main/java/tools/jackson/jr/extension/javatime/LocalDateTimeValueReader.java @@ -19,6 +19,6 @@ public LocalDateTimeValueReader(DateTimeFormatter formatter) { @Override public Object read(JSONReader reader, JsonParser p) throws JacksonException { - return LocalDateTime.parse(p.getText(), formatter); + return LocalDateTime.parse(p.getString(), formatter); } } diff --git a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/AnyReader.java b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/AnyReader.java index d2594244..0abebcd0 100644 --- a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/AnyReader.java +++ b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/AnyReader.java @@ -40,7 +40,7 @@ public Object readNext(JSONReader r, JsonParser p) throws JacksonException } return readArrayFromArray(r, p, r._collectionBuilder); case ID_STRING: - return fromString(p.getText()); + return fromString(p.getString()); case ID_NUMBER_INT: { NumberType n = p.getNumberType(); @@ -97,7 +97,7 @@ public Object read(JSONReader r, JsonParser p) throws JacksonException } return readArrayFromArray(r, p, r._collectionBuilder); case ID_STRING: - return fromString(p.getText()); + return fromString(p.getString()); case ID_NUMBER_INT: { NumberType n = p.getNumberType(); diff --git a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanReader.java b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanReader.java index d6b38da1..d1175ec3 100644 --- a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanReader.java +++ b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanReader.java @@ -156,7 +156,7 @@ public Object read(JSONReader r, JsonParser p) throws JacksonException case JsonTokenId.ID_NULL: return null; case JsonTokenId.ID_STRING: - return _constructors.create(p.getText()); + return _constructors.create(p.getString()); case JsonTokenId.ID_NUMBER_INT: return _constructors.create(p.getLongValue()); default: @@ -191,7 +191,7 @@ public Object readNext(JSONReader r, JsonParser p) throws JacksonException case VALUE_NULL: return null; case VALUE_STRING: - return _constructors.create(p.getText()); + return _constructors.create(p.getString()); case VALUE_NUMBER_INT: return _constructors.create(p.getLongValue()); default: diff --git a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/EnumReader.java b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/EnumReader.java index 2b8a8d40..5f46adcf 100644 --- a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/EnumReader.java +++ b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/EnumReader.java @@ -34,7 +34,7 @@ private String desc() { @Override public Object readNext(JSONReader reader, JsonParser p) throws JacksonException { - String name = p.nextTextValue(); + String name = p.nextStringValue(); if (name != null) { return _enum(name); } diff --git a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/SimpleValueReader.java b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/SimpleValueReader.java index 23c0d419..dc988b78 100644 --- a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/SimpleValueReader.java +++ b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/SimpleValueReader.java @@ -43,7 +43,7 @@ public Object readNext(JSONReader reader, JsonParser p) throws JacksonException case SER_STRING: case SER_CHARACTER_SEQUENCE: { - String str = p.nextTextValue(); + String str = p.nextStringValue(); if (str != null) { return str; } @@ -52,7 +52,7 @@ public Object readNext(JSONReader reader, JsonParser p) throws JacksonException case SER_CHAR_ARRAY: { - String str = p.nextTextValue(); + String str = p.nextStringValue(); if (str != null) { return str.toCharArray(); } diff --git a/jr-objects/src/test/java/tools/jackson/jr/ob/impl/CustomValueReadersTest.java b/jr-objects/src/test/java/tools/jackson/jr/ob/impl/CustomValueReadersTest.java index 52df7292..231e4106 100644 --- a/jr-objects/src/test/java/tools/jackson/jr/ob/impl/CustomValueReadersTest.java +++ b/jr-objects/src/test/java/tools/jackson/jr/ob/impl/CustomValueReadersTest.java @@ -63,7 +63,7 @@ public ABCValueReader() { @Override public Object read(JSONReader reader, JsonParser p) { - final String str = p.getText(); + final String str = p.getString(); if ("n/a".equals(str)) { return ABC.DEF; } @@ -78,7 +78,7 @@ public CapStringReader() { @Override public Object read(JSONReader reader, JsonParser p) { - return p.getText().toUpperCase(); + return p.getString().toUpperCase(); } } diff --git a/jr-objects/src/test/java/tools/jackson/jr/ob/impl/ValueReaderModifierTest.java b/jr-objects/src/test/java/tools/jackson/jr/ob/impl/ValueReaderModifierTest.java index 7715bf56..f52d4c3e 100644 --- a/jr-objects/src/test/java/tools/jackson/jr/ob/impl/ValueReaderModifierTest.java +++ b/jr-objects/src/test/java/tools/jackson/jr/ob/impl/ValueReaderModifierTest.java @@ -76,7 +76,7 @@ public void testStringReaderReplacement() throws Exception new ValueReader(String.class) { @Override public Object read(JSONReader reader, JsonParser p) { - return p.getText().toUpperCase(); + return p.getString().toUpperCase(); }; }); assertEquals("FOOBAR", diff --git a/jr-stree/src/main/java/tools/jackson/jr/stree/JacksonJrsTreeCodec.java b/jr-stree/src/main/java/tools/jackson/jr/stree/JacksonJrsTreeCodec.java index 7ea3981c..671ae2fe 100644 --- a/jr-stree/src/main/java/tools/jackson/jr/stree/JacksonJrsTreeCodec.java +++ b/jr-stree/src/main/java/tools/jackson/jr/stree/JacksonJrsTreeCodec.java @@ -52,7 +52,7 @@ private JrsValue nodeFrom(JsonParser p) throws JacksonException } return new JrsNumber(p.getNumberValue()); case JsonTokenId.ID_STRING: - return new JrsString(p.getText()); + return new JrsString(p.getString()); case JsonTokenId.ID_START_ARRAY: { List values = _list(); while (p.nextToken() != JsonToken.END_ARRAY) { diff --git a/jr-stree/src/main/java/tools/jackson/jr/stree/util/JrsTreeTraversingParser.java b/jr-stree/src/main/java/tools/jackson/jr/stree/util/JrsTreeTraversingParser.java index a190e651..850d4afb 100644 --- a/jr-stree/src/main/java/tools/jackson/jr/stree/util/JrsTreeTraversingParser.java +++ b/jr-stree/src/main/java/tools/jackson/jr/stree/util/JrsTreeTraversingParser.java @@ -234,7 +234,7 @@ public TokenStreamLocation currentLocation() { */ @Override - public String getText() + public String getString() { if (_closed) { return null; @@ -255,22 +255,22 @@ public String getText() } @Override - public char[] getTextCharacters() throws JacksonException { - return getText().toCharArray(); + public char[] getStringCharacters() throws JacksonException { + return getString().toCharArray(); } @Override - public int getTextLength() throws JacksonException { - return getText().length(); + public int getStringLength() throws JacksonException { + return getString().length(); } @Override - public int getTextOffset() throws JacksonException { + public int getStringOffset() throws JacksonException { return 0; } @Override - public boolean hasTextCharacters() { + public boolean hasStringCharacters() { // generally we do not have efficient access as char[], hence: return false; }