Skip to content

Commit 798c81b

Browse files
committed
Merge branch '3.2' into 3.x
2 parents beea723 + 9983d7a commit 798c81b

6 files changed

Lines changed: 114 additions & 2 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tools.jackson.dataformat.cbor.databind.CBORMapper
1+
tools.jackson.dataformat.cbor.CBORMapper
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package tools.jackson.dataformat.cbor;
2+
3+
import java.io.File;
4+
import java.nio.charset.StandardCharsets;
5+
import java.nio.file.Files;
6+
import java.util.List;
7+
8+
import org.junit.jupiter.api.Test;
9+
10+
import tools.jackson.databind.ObjectMapper;
11+
12+
import static org.junit.jupiter.api.Assertions.*;
13+
14+
// [dataformats-binary#700]: SPI file referenced wrong class name
15+
// (`...cbor.databind.CBORMapper` instead of `...cbor.CBORMapper`),
16+
// causing `ServiceConfigurationError` from `ServiceLoader` for classpath
17+
// (non-modular) usage.
18+
//
19+
// NOTE: the SPI file only governs classpath usage; modular usage is covered by
20+
// the `provides` directive in `module-info.java`. Since the test harness runs on
21+
// the module path (where the module's own resources are not reachable), this test
22+
// validates the source SPI file content directly instead of via `ServiceLoader`.
23+
public class ServiceLoader700Test extends CBORTestBase
24+
{
25+
private final static File SERVICE_FILE = new File(
26+
"src/main/resources/META-INF/services/tools.jackson.databind.ObjectMapper");
27+
28+
@Test
29+
public void testServiceFileClassNamesResolve() throws Exception
30+
{
31+
assertTrue(SERVICE_FILE.exists(), "Missing SPI file: " + SERVICE_FILE.getAbsolutePath());
32+
boolean foundCBORMapper = false;
33+
List<String> lines = Files.readAllLines(SERVICE_FILE.toPath(), StandardCharsets.UTF_8);
34+
for (String line : lines) {
35+
line = line.trim();
36+
if (line.isEmpty() || line.startsWith("#")) {
37+
continue;
38+
}
39+
// Class named in SPI file must actually exist and be an `ObjectMapper`...
40+
Class<?> cls = Class.forName(line);
41+
assertTrue(ObjectMapper.class.isAssignableFrom(cls),
42+
"Class `" + line + "` is not an `ObjectMapper` subtype");
43+
if (cls == CBORMapper.class) {
44+
foundCBORMapper = true;
45+
}
46+
}
47+
assertTrue(foundCBORMapper,
48+
"SPI file should list `" + CBORMapper.class.getName() + "`");
49+
}
50+
}

release-notes/CREDITS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ Shanchao Li (@tonghuaroot)
4444
* Reported #693: (avro) Incomplete number length validation in Avro
4545
decoder (for `BigDecimal`)
4646
(3.1.4)
47+
48+
Juan Farré (@jafarre-bi)
49+
50+
* Reported #700: (cbor, smile) `META-INF/services/tools.jackson.databind.ObjectMapper`
51+
references wrong class name (`...databind.CBORMapper` / `...databind.SmileMapper`)
52+
(3.1.5)

release-notes/VERSION

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ No changes since 3.2
2424
method signatures
2525
#674: Smile parser does not update `StreamReadContext` index or entry count
2626

27+
3.1.5 (not yet released)
28+
29+
#700: (cbor, smile) `META-INF/services/tools.jackson.databind.ObjectMapper`
30+
references wrong class name (`...databind.CBORMapper` / `...databind.SmileMapper`)
31+
(reported by Juan F)
32+
2733
3.1.4 (29-May-2026)
2834

2935
#691: (cbor) Add parameterized tests covering all ASCII-optimization exit paths
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tools.jackson.dataformat.smile.databind.SmileMapper
1+
tools.jackson.dataformat.smile.SmileMapper
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package tools.jackson.dataformat.smile;
2+
3+
import java.io.File;
4+
import java.nio.charset.StandardCharsets;
5+
import java.nio.file.Files;
6+
import java.util.List;
7+
8+
import org.junit.jupiter.api.Test;
9+
10+
import tools.jackson.databind.ObjectMapper;
11+
12+
import static org.junit.jupiter.api.Assertions.*;
13+
14+
// [dataformats-binary#700]: SPI file referenced wrong class name
15+
// (`...smile.databind.SmileMapper` instead of `...smile.SmileMapper`),
16+
// causing `ServiceConfigurationError` from `ServiceLoader` for classpath
17+
// (non-modular) usage.
18+
//
19+
// NOTE: the SPI file only governs classpath usage; modular usage is covered by
20+
// the `provides` directive in `module-info.java`. Since the test harness runs on
21+
// the module path (where the module's own resources are not reachable), this test
22+
// validates the source SPI file content directly instead of via `ServiceLoader`.
23+
public class ServiceLoader700Test extends BaseTestForSmile
24+
{
25+
private final static File SERVICE_FILE = new File(
26+
"src/main/resources/META-INF/services/tools.jackson.databind.ObjectMapper");
27+
28+
@Test
29+
public void testServiceFileClassNamesResolve() throws Exception
30+
{
31+
assertTrue(SERVICE_FILE.exists(), "Missing SPI file: " + SERVICE_FILE.getAbsolutePath());
32+
boolean foundSmileMapper = false;
33+
List<String> lines = Files.readAllLines(SERVICE_FILE.toPath(), StandardCharsets.UTF_8);
34+
for (String line : lines) {
35+
line = line.trim();
36+
if (line.isEmpty() || line.startsWith("#")) {
37+
continue;
38+
}
39+
// Class named in SPI file must actually exist and be an `ObjectMapper`...
40+
Class<?> cls = Class.forName(line);
41+
assertTrue(ObjectMapper.class.isAssignableFrom(cls),
42+
"Class `" + line + "` is not an `ObjectMapper` subtype");
43+
if (cls == SmileMapper.class) {
44+
foundSmileMapper = true;
45+
}
46+
}
47+
assertTrue(foundSmileMapper,
48+
"SPI file should list `" + SmileMapper.class.getName() + "`");
49+
}
50+
}

0 commit comments

Comments
 (0)