Miroslav Nachev created JOHNZON-169:
---------------------------------------

             Summary: @JsonbTypeDeserializer(xxxJsonbDeserializer.class) is not 
working properly
                 Key: JOHNZON-169
                 URL: https://issues.apache.org/jira/browse/JOHNZON-169
             Project: Johnzon
          Issue Type: Bug
          Components: JSON-B
    Affects Versions: 1.1.7
         Environment: JDK8, Windows 10

 
            Reporter: Miroslav Nachev


I have made my own JonsArray converter in JavaClass, which works properly when 
called alone. For this purpose, I have used an annotation:
@JsonbTypeDeserializer(Student.StudentDeserializer.class)
public class Student \{...}
public static class StudentDeserializer implements JsonbDeserializer<Student> 
\{...}

The problem comes, when this object Student is part of an array (List), that is 
located in another object:

public class SomeStudentsList {
 private List<Student> students = new ArrayList<>();
}

json=\{"students":[["Value-1","Value-2","Value-N"], 
["Value-1","Value-2","Value-N"], ["Value-1","Value-2","Value-N"]]}

The result exception is:
Exception in thread "main" java.lang.UnsupportedOperationException: type class 
eu.nscenter.scilearn.manage.Student not supported
at 
org.apache.johnzon.mapper.MappingParserImpl.buildArray(MappingParserImpl.java:602)
at 
org.apache.johnzon.mapper.MappingParserImpl.toObject(MappingParserImpl.java:518)
at 
org.apache.johnzon.mapper.MappingParserImpl.toValue(MappingParserImpl.java:699)
at 
org.apache.johnzon.mapper.MappingParserImpl.mapCollection(MappingParserImpl.java:644)
at 
org.apache.johnzon.mapper.MappingParserImpl.buildArray(MappingParserImpl.java:594)
at 
org.apache.johnzon.mapper.MappingParserImpl.toObject(MappingParserImpl.java:518)
at 
org.apache.johnzon.mapper.MappingParserImpl.toValue(MappingParserImpl.java:699)
at 
org.apache.johnzon.mapper.MappingParserImpl.buildObject(MappingParserImpl.java:338)
at 
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:141)
at 
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:133)
at 
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:125)
at org.apache.johnzon.mapper.Mapper.mapObject(Mapper.java:254)
at org.apache.johnzon.mapper.Mapper.readObject(Mapper.java:189)
at org.apache.johnzon.mapper.Mapper.readObject(Mapper.java:184)
at org.apache.johnzon.jsonb.JohnzonJsonb.fromJson(JohnzonJsonb.java:58)
at eu.nscenter.scilearn.manage.StudentsList.main(StudentsList.java:118)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to