File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
main/java/tools/jackson/dataformat/avro/schema
test/java/tools/jackson/dataformat/avro/schema Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1111import tools .jackson .databind .introspect .AnnotatedClass ;
1212import tools .jackson .databind .jsonFormatVisitors .JsonStringFormatVisitor ;
1313import tools .jackson .databind .jsonFormatVisitors .JsonValueFormat ;
14- import tools .jackson .databind .type .TypeFactory ;
1514
1615public class StringVisitor extends JsonStringFormatVisitor .Base
1716 implements SchemaBuilder
@@ -38,7 +37,8 @@ public void enumTypes(Set<String> enums) {
3837 public Schema builtAvroSchema () {
3938 // Unlike Jackson, Avro treats characters as an int with the java.lang.Character class type.
4039 if (_type .hasRawClass (char .class ) || _type .hasRawClass (Character .class )) {
41- return AvroSchemaHelper .numericAvroSchema (NumberType .INT , TypeFactory .defaultInstance ().constructType (Character .class ));
40+ // should we construct JavaType for `Character.class` in case of primitive or... ?
41+ return AvroSchemaHelper .numericAvroSchema (NumberType .INT , _type );
4242 }
4343 // [dataformats-binary#179]: need special help with UUIDs, to coerce into Binary
4444 // (could actually be
Original file line number Diff line number Diff line change 2626@ RunWith (Parameterized .class )
2727public class DateTimeVisitor_builtAvroSchemaTest {
2828
29- private static final TypeFactory TYPE_FACTORY = TypeFactory .defaultInstance ();
30-
3129 @ Parameter (0 )
3230 public Class <?> testClass ;
3331
@@ -73,14 +71,16 @@ public static Collection<?> testData() {
7371 LocalTime .class ,
7472 JsonParser .NumberType .INT ,
7573 Schema .Type .INT ,
76- "time-millis" },
74+ "time-millis"
75+ }
7776 });
7877 }
7978
8079 @ Test
8180 public void builtAvroSchemaTest () {
8281 // GIVEN
83- DateTimeVisitor dateTimeVisitor = new DateTimeVisitor (TYPE_FACTORY .constructSimpleType (testClass , null ));
82+ final TypeFactory tf = TypeFactory .createDefaultInstance ();
83+ DateTimeVisitor dateTimeVisitor = new DateTimeVisitor (tf .constructSimpleType (testClass , null ));
8484 dateTimeVisitor .numberType (givenNumberType );
8585
8686 // WHEN
You can’t perform that action at this time.
0 commit comments