Skip to content

Commit 41ab6b3

Browse files
committed
Update avro to 1.11.3
Namespace for nested classes no longer ends with '$'. This is how avro library generates schema since version 1.9. See: AVRO-2143 Please note that resolution of nested classes without '$' was implemented long ago in c570549. Fixes FasterXML#167
1 parent 2fb7e1d commit 41ab6b3

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

avro/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ abstractions.
4747
<dependency>
4848
<groupId>org.apache.avro</groupId>
4949
<artifactId>avro</artifactId>
50-
<version>1.8.2</version>
50+
<version>1.11.3</version>
5151
</dependency>
5252

5353
<!-- and for testing we need logback -->

avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/AvroSchemaHelper.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected static String getNamespace(Class<?> cls) {
108108
// NOTE: was reverted in 2.8.8, but is enabled for Jackson 2.9.
109109
Class<?> enclosing = cls.getEnclosingClass();
110110
if (enclosing != null) {
111-
return enclosing.getName() + "$";
111+
return enclosing.getName();
112112
}
113113
Package pkg = cls.getPackage();
114114
return (pkg == null) ? "" : pkg.getName();
@@ -351,6 +351,7 @@ public static String getFullName(Schema schema) {
351351
if (namespace == null) {
352352
return name;
353353
}
354+
// Backward compatibility with schemas that use dollar sign for nested classes (Apache Avro before 1.9)
354355
final int len = namespace.length();
355356
if (namespace.charAt(len-1) == '$') {
356357
return namespace + name;

avro/src/test/java/com/fasterxml/jackson/dataformat/avro/annotation/AvroNamespaceTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void class_without_AvroNamespace_test() throws Exception {
3535

3636
// THEN
3737
assertThat(actualSchema.getNamespace())
38-
.isEqualTo("com.fasterxml.jackson.dataformat.avro.annotation.AvroNamespaceTest$");
38+
.isEqualTo("com.fasterxml.jackson.dataformat.avro.annotation.AvroNamespaceTest");
3939
}
4040

4141
@Test
@@ -65,7 +65,7 @@ public void enum_without_AvroNamespace_test() throws Exception {
6565

6666
// THEN
6767
assertThat(actualSchema.getNamespace())
68-
.isEqualTo("com.fasterxml.jackson.dataformat.avro.annotation.AvroNamespaceTest$");
68+
.isEqualTo("com.fasterxml.jackson.dataformat.avro.annotation.AvroNamespaceTest");
6969
}
7070

7171
@Test

avro/src/test/java/com/fasterxml/jackson/dataformat/avro/interop/annotations/AvroAliasTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class AvroAliasTest extends InteropTestBase {
1717

18-
@AvroAlias(alias = "Employee", space = "com.fasterxml.jackson.dataformat.avro.AvroTestBase$")
18+
@AvroAlias(alias = "Employee", space = "com.fasterxml.jackson.dataformat.avro.AvroTestBase")
1919
public static class NewEmployee {
2020

2121
public String name;
@@ -40,7 +40,7 @@ public static class AliasedNameEmployee {
4040
public AliasedNameEmployee boss;
4141
}
4242

43-
@AvroAlias(alias = "Size", space = "com.fasterxml.jackson.dataformat.avro.AvroTestBase$")
43+
@AvroAlias(alias = "Size", space = "com.fasterxml.jackson.dataformat.avro.AvroTestBase")
4444
public enum NewSize {
4545
SMALL,
4646
LARGE;

0 commit comments

Comments
 (0)