felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Bosschaert (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-5666) Serializer goes into infinite loop
Date Thu, 03 Aug 2017 12:33:00 GMT

    [ https://issues.apache.org/jira/browse/FELIX-5666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16112648#comment-16112648

David Bosschaert commented on FELIX-5666:

Ah yes, exactly. The sourceAsDTO() is context information to the converter in relation to
the provided object. It has no connection to the Json Serializer and it's also not stored
in the converter. So when the serializer is called that information is simply not there any

I guess it might make sense to add things like sourceAsDTO() and others to the serializer?
It might even inherit the Specifying.java interface from the Converter ([see here|https://oss.sonatype.org/content/repositories/osgi/org/osgi/org.osgi.util.converter/1.0.0-SNAPSHOT/org.osgi.util.converter-1.0.0-20170803.091235-72-sources.jar])...

WDYT about adding something like this to the serializer?

> Serializer goes into infinite loop
> ----------------------------------
>                 Key: FELIX-5666
>                 URL: https://issues.apache.org/jira/browse/FELIX-5666
>             Project: Felix
>          Issue Type: Bug
>          Components: Converter
>            Reporter: David Leangen
>            Assignee: David Bosschaert
> I'm only guessing as to what the problem is, following some stepping through the code.
I could not find any similar existing test cases, but if the following does not immediately
click for [~bosschaert], I will try to add one.
> It appears that, when serializing an object to a "DTO-Type" object to a Map, some kind
of backing object is created.
> If the backing object contains a field that instantiates the same DTO, then the loop
gets created.
> Example:
> {code}
> public class MyDtoType {
>   public String id;
>   public MyDtoType( String anID ) {
>     id = anID;
>   }
>   public static MyDtoType error() {
>     return new MyDtoType( "ERROR" );
>   }
> }
> {code}
> It looks like the serializer keeps calling the error() method infinitely, but I am not
able to easily pinpoint where this happens.

This message was sent by Atlassian JIRA

View raw message