users@jersey.java.net

Re: [Jersey] Important bug found

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Tue, 02 Dec 2008 20:08:03 +0100

It is too late and i am typing too fast,
after i updated your JAXBContextResolver to contain:

    @SuppressWarnings("unchecked")
  public JAXBContextResolver() throws Exception {
       Map props = new HashMap<String, Object>();
       props.put(JSONJAXBContext.JSON_NOTATION, JSONJAXBContext.JSONNotation.MAPPED);
       typesList = Arrays.asList(types);
       this.context = new JSONJAXBContext(types, props);
       
    }


Then internal JSON format is used and the JSON expression looks like:

{"folder":
  {"id":"id:folder",
   "keyword":{"id":"id:keywordfolder",
              "name":"name:keywordfolder"},
    "name":"name:folder",
    "page":{"id":"id:page",
            "keyword":{"id":"id:keywordpage",
                       "name":"name:keywordpage"},
            "name":"name:page"}}}

Which should be OK for you, right?

~Jakub

On Tue, Dec 02, 2008 at 07:56:34PM +0100, Jakub Podlesak wrote:
>
> Hi Jeffrey,
>
> please see in lines...
>
> On Tue, Dec 02, 2008 at 02:49:30PM -0200, Jeffrey wrote:
> > Hi Paul,
> >
> > Imagine having the following object-structure:
> >
> > Folder has, among other fields, a list of Pages and a list of Keywords.
> > A Page has, among other fields, a list of Keywords.
> > A Keyword has an id and a name.
> >
> > In this example we have and object model corresponding to the following xml:
> > <folder>
> > <id>id:folder</id>
> > <keyword>
> > <id>id:keywordfolder</id>
> > <name>name:keywordfolder</name>
> > </keyword>
> > <name>name:folder</name>
> > <page>
> > <id>id:page</id>
> > <keyword>
> > <id>id:keywordpage</id>
> > <name>name:keywordpage</name>
> > </keyword>
> > <name>name:page</name>
> > </page>
> > </folder>
> >
> >
> > The expected json output, using a provider that generates the jettison
>
> It is a jettison bug. I can file it for you (tomorow), but i am afraid
> i won't be able to fix it.
>
> However:
>
> > format, is:
> > {"folder":
>
> You do not want to use Jersey format, because this:
>
> > { "id":"id:folder",
>
> is serialized out as:
>
> {"id":{"$":"id:folder"}
>
> ?
>
> If this is the case, i believe i can make some improvement in Jersey
> and than i will be in control when this gets fixed for you.
>
> Would it help?
>
> I mean, improving internal format and switching over to it in your app?
>
> ~Jakub
>
> > "keyword":{"id":"id:keywordfolder","name":"name:keywordfolder"},
> > "name":"name:folder",
> > "page":
> > { "id":"id:page",
> > "keyword":{"id":"id:keywordpage","name":"name:keywordpage"},
> > "name":"name:page"
> > }
> > }
> > }
> >
> > However, the generated json was:
> > {"folder":
> > { "id":"id:folder",
> > "keyword":[ {"id":"id:keywordfolder","name":"name:keywordfolder"},
> >
> > *{"id":"id:keywordpage","name":"name:keywordpage"}*],
> > "name":"name:folder",
> > "page":{"id":"id:page"}
> > },
> > *"name":"name:page"*
> > }
> >
> > As you can see the keyword belonging to the page object was put together
> > (in an array) with the keyword of the folder.
> > Besides this, the name of the page does not longer belong to the page but
> > is part of the folder.
> >
> > I´ve attached a jersey application with a service that generates the
> > following output. It is using the newest version released: 1.0.1.
> > To use the service build the project, run BuggedServer.java and call the
> > url: http://localhost:8002/services/bug
> >
> > We´re creating a business critical application based on jersey and are
> > facing this bug since the migration from version 0.8 to 1.0.
> > Do you have any idea how long it will take to fix it?
> >
> > Hoping to hear from you,
> > Jeffrey
> >
> >
> >
> >
> > Paul Sandoz wrote:
> >> Hi Jeffrey,
> >>
> >> You can report it here on this list.
> >>
> >> Or you can log an issue here:
> >>
> >> https://jersey.dev.java.net/issues/
> >>
> >> to do the latter you will require a java.net account.
> >>
> >>
> >> Note that we have just released version 1.0.1, perhaps it is fixed in that
> >> release?
> >>
> >> Paul.
> >>
> >> On Dec 2, 2008, at 2:58 PM, Jeffrey wrote:
> >>
> >>> I´d like to registrer an important bug that I found yesterday, but i
> >>> can´t find any relevant e-mail address to send the explication +
> >>> application to demonstrate.
> >>>
> >>> Can you please explain where to send this recently introduzed bug
> >>> (version 1.0).
> >>>
> >>> I´m looking forward to you answer,
> >>> Jeffrey van Helden
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> >>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >>>
> >>
> >
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>