Skip to content

Commit 2c2bc97

Browse files
committed
Fix compilation issues wrt tests, [databind/5263]
1 parent 14a5136 commit 2c2bc97

File tree

4 files changed

+23
-44
lines changed

4 files changed

+23
-44
lines changed

ion/src/test/java/tools/jackson/dataformat/ion/DatabindRead303Test.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

ion/src/test/java/tools/jackson/dataformat/ion/EnumAsIonSymbolSerializationTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import org.junit.jupiter.api.Test;
2222

23-
import tools.jackson.databind.SerializationFeature;
2423
import tools.jackson.databind.cfg.EnumFeature;
2524

2625
import static org.junit.jupiter.api.Assertions.assertEquals;

ion/src/test/java/tools/jackson/dataformat/ion/misc/UncaughtExceptionsTest.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package tools.jackson.dataformat.ion.misc;
22

3-
import java.net.URL;
3+
import java.io.InputStream;
44

55
import org.junit.jupiter.api.Test;
66

@@ -21,15 +21,28 @@ public class UncaughtExceptionsTest
2121
@Test
2222
public void testUncaughtException302() throws Exception
2323
{
24-
URL poc = getClass().getResource("/data/issue-302.ion");
25-
try {
26-
MAPPER.readTree(poc);
24+
try (InputStream in = getClass().getResourceAsStream("/data/issue-302.ion")) {
25+
MAPPER.readTree(in);
2726
fail("Should not pass with invalid content");
2827
} catch (StreamReadException e) {
2928
verifyException(e, "Invalid embedded TIMESTAMP");
3029
}
3130
}
3231

32+
// [dataformats-binary#303]
33+
@Test
34+
public void testUncaughtException303() throws Exception
35+
{
36+
try (InputStream in = getClass().getResourceAsStream("/data/issue-303.ion")) {
37+
MAPPER.readTree(in);
38+
fail("Should not pass with invalid content");
39+
} catch (StreamReadException e) {
40+
// 19-Dec-2023, tatu: Looks like message depends on ion-java version,
41+
// cannot easily verify
42+
// verifyException(e, "Value exceeds the length of its parent container");
43+
}
44+
}
45+
3346
void verifyException(Throwable e, String match)
3447
{
3548
String msg = e.getMessage();

protobuf/src/main/java/tools/jackson/dataformat/protobuf/schema/DescriptorLoader.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ public static DescriptorLoader construct(ObjectMapper mapper,
6868

6969
public FileDescriptorSet load(URL src) throws IOException
7070
{
71-
return _reader.readValue(Objects.requireNonNull(src));
71+
Objects.requireNonNull(src);
72+
// 19-Aug-2025, tatu: databind no longer supports URL-based loading,
73+
// should use InputStream instead. But...
74+
try (InputStream in = src.openStream()) {
75+
return _reader.readValue(in);
76+
}
7277
}
7378

7479
public FileDescriptorSet load(File src) throws IOException

0 commit comments

Comments
 (0)