Skip to content

Commit

Permalink
Fix compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 1, 2025
1 parent edb846e commit 9bedc40
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static AvroFieldReader createDefaulter(String name,
return new ScalarDefaults.FloatDefaults(name, defaultAsNode.asLong());
}
case VALUE_STRING:
return new ScalarDefaults.StringDefaults(name, defaultAsNode.asText());
return new ScalarDefaults.StringDefaults(name, defaultAsNode.asString());
case START_OBJECT:
{
List<AvroFieldReader> readers = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ protected Schema reorderUnionToMatchDefaultType(Schema schema, JsonNode defaultV
if (matchingIndex == null) {
matchingIndex = schema.getIndexNamed(Type.INT.getName());
}
} else if (defaultValue.isTextual()) {
} else if (defaultValue.isString()) {
matchingIndex = schema.getIndexNamed(Type.STRING.getName());
if (matchingIndex == null) {
// search for an enum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void testSimple() throws Exception
// now, deserialize
JsonNode top2 = MAPPER.readValue(doc, JsonNode.class);
JsonNode foo2 = top2.get("foo");
assertEquals("baz", foo2.get("bar").textValue());
assertEquals("baz", foo2.get("bar").stringValue());

JsonNode datNode = foo2.get("dat");
if (!datNode.isBinary()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ public void testSimple() throws Exception
assertEquals(SAMPLE_SPEC_VALUE_HEIGHT, ob.intValue());

ob = imageMap.get("Title");
assertTrue(ob.isTextual());
assertEquals(SAMPLE_SPEC_VALUE_TITLE, ob.textValue());
assertTrue(ob.isString());
assertEquals(SAMPLE_SPEC_VALUE_TITLE, ob.stringValue());

ob = imageMap.get("Thumbnail");
assertType(ob, ObjectNode.class);
ObjectNode tn = (ObjectNode) ob;
ob = tn.get("Url");
assertTrue(ob.isTextual());
assertEquals(SAMPLE_SPEC_VALUE_TN_URL, ob.textValue());
assertTrue(ob.isString());
assertEquals(SAMPLE_SPEC_VALUE_TN_URL, ob.stringValue());
ob = tn.get("Height");
assertTrue(ob.isIntegralNumber());
assertEquals(SAMPLE_SPEC_VALUE_TN_HEIGHT, ob.intValue());
ob = tn.get("Width");
assertTrue(ob.isTextual());
assertEquals(SAMPLE_SPEC_VALUE_TN_WIDTH, ob.textValue());
assertTrue(ob.isString());
assertEquals(SAMPLE_SPEC_VALUE_TN_WIDTH, ob.stringValue());

ob = imageMap.get("IDs");
assertTrue(ob.isArray());
Expand Down Expand Up @@ -87,14 +87,14 @@ public void testMultiple() throws Exception

assertTrue(result.isIntegralNumber());
assertTrue(result.isInt());
assertFalse(result.isTextual());
assertFalse(result.isString());
assertEquals(12, result.intValue());

result = MAPPER.readTree(p);
assertTrue(result.isTextual());
assertTrue(result.isString());
assertFalse(result.isIntegralNumber());
assertFalse(result.isInt());
assertEquals("string", result.textValue());
assertEquals("string", result.stringValue());

result = MAPPER.readTree(p);
assertTrue(result.isArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void testWithNestedMaps() throws IOException
assertEquals(1, n2.size());
JsonNode n3 = n2.get("");
assertNotNull(n3);
assertTrue(n3.isTextual());
assertTrue(n3.isString());
}

// for [dataformat-smile#26]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void testSimple() throws Exception
// now, deserialize
JsonNode top2 = MAPPER.readValue(doc, JsonNode.class);
JsonNode foo2 = top2.get("foo");
assertEquals("baz", foo2.get("bar").textValue());
assertEquals("baz", foo2.get("bar").stringValue());

JsonNode datNode = foo2.get("dat");
if (!datNode.isBinary()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ public void testSimple() throws Exception
assertEquals(SAMPLE_SPEC_VALUE_HEIGHT, ob.intValue());

ob = imageMap.get("Title");
assertTrue(ob.isTextual());
assertEquals(SAMPLE_SPEC_VALUE_TITLE, ob.textValue());
assertTrue(ob.isString());
assertEquals(SAMPLE_SPEC_VALUE_TITLE, ob.stringValue());

ob = imageMap.get("Thumbnail");
assertType(ob, ObjectNode.class);
ObjectNode tn = (ObjectNode) ob;
ob = tn.get("Url");
assertTrue(ob.isTextual());
assertEquals(SAMPLE_SPEC_VALUE_TN_URL, ob.textValue());
assertTrue(ob.isString());
assertEquals(SAMPLE_SPEC_VALUE_TN_URL, ob.stringValue());
ob = tn.get("Height");
assertTrue(ob.isIntegralNumber());
assertEquals(SAMPLE_SPEC_VALUE_TN_HEIGHT, ob.intValue());
ob = tn.get("Width");
assertTrue(ob.isTextual());
assertEquals(SAMPLE_SPEC_VALUE_TN_WIDTH, ob.textValue());
assertTrue(ob.isString());
assertEquals(SAMPLE_SPEC_VALUE_TN_WIDTH, ob.stringValue());

ob = imageMap.get("IDs");
assertTrue(ob.isArray());
Expand Down Expand Up @@ -87,14 +87,14 @@ public void testMultiple() throws Exception

assertTrue(result.isIntegralNumber());
assertTrue(result.isInt());
assertFalse(result.isTextual());
assertFalse(result.isString());
assertEquals(12, result.intValue());

result = MAPPER.readTree(p);
assertTrue(result.isTextual());
assertTrue(result.isString());
assertFalse(result.isIntegralNumber());
assertFalse(result.isInt());
assertEquals("string", result.textValue());
assertEquals("string", result.stringValue());

result = MAPPER.readTree(p);
assertTrue(result.isArray());
Expand Down

0 comments on commit 9bedc40

Please sign in to comment.