users@jersey.java.net

Re: [Jersey] RE: problem with client and collections

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 14 Jan 2010 15:38:31 +0100

On Jan 14, 2010, at 3:22 PM, Florian Hehlen wrote:

> Hi all,
>
> I have found my problem! It was with some entities in my jaxb
> objects that were being initialized with EmptyList.
>

Phew, glad you found that cause i was scratching my head :-)

Paul.

> Cheers,
> Florian
>
> -----Original Message-----
> From: Florian Hehlen [mailto:Florian.Hehlen_at_imc.nl]
> Sent: 14 January, 2010 15:04
> To: 'users_at_jersey.dev.java.net'
> Subject: [Jersey] problem with client and collections
>
> Hi,
>
> I am getting a UnsupportedOperationException when I try to access a
> resource with the client. The strange thing is that this does not
> happen with every collection based calls. I can also confirm that I
> can see the right result when I try to make the call using a web
> browser.
>
> server side method:
>
> @GET
> @Path("desc/{descriptor:.*}")
> public List<IdsSymbol> findAll(@PathParam("descriptor")String
> aDescriptor)
> {
> return internalService.findAll(aDescriptor);
> }
>
> the client call:
>
> IdsSymbol[] symbols = theResource
> .path("desc/" + aDescriptor)
> .getRequestBuilder()
> .accept(theMediaType).get(IdsSymbol[].class);
>
> Here is the exception:
>
> Exception in thread "main" java.lang.UnsupportedOperationException
> at java.util.AbstractList.add(AbstractList.java:131)
> at java.util.AbstractList.add(AbstractList.java:91)
> at com.sun.xml.internal.bind.v2.runtime.reflect.Lister
> $CollectionLister.addToPack(Lister.java:290)
> at com.sun.xml.internal.bind.v2.runtime.reflect.Lister
> $CollectionLister.addToPack(Lister.java:254)
> at
> com
> .sun
> .xml
> .internal
> .bind.v2.runtime.reflect.AdaptedLister.addToPack(AdaptedLister.java:
> 71)
> at
> com
> .sun.xml.internal.bind.v2.runtime.unmarshaller.Scope.add(Scope.java:
> 106)
> at
> com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty
> $ReceiverImpl.receive(ArrayERProperty.java:195)
> at
> com
> .sun
> .xml
> .internal
> .bind
> .v2
> .runtime
> .unmarshaller
> .UnmarshallingContext.endElement(UnmarshallingContext.java:507)
> at
> com
> .sun
> .xml
> .internal
> .bind
> .v2
> .runtime
> .unmarshaller
> .InterningXmlVisitor.endElement(InterningXmlVisitor.java:66)
> at
> com
> .sun
> .xml
> .internal
> .bind
> .v2
> .runtime
> .unmarshaller
> .StAXStreamConnector.handleEndElement(StAXStreamConnector.java:206)
> at
> com
> .sun
> .xml
> .internal
> .bind
> .v2
> .runtime
> .unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:170)
> at
> com
> .sun
> .xml
> .internal
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:349)
> at
> com
> .sun
> .xml
> .internal
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:321)
> at
> com
> .sun
> .jersey
> .core
> .provider
> .jaxb
> .AbstractListElementProvider
> .readFrom(AbstractListElementProvider.java:213)
> at
> com
> .sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:
> 532)
> at
> com
> .sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:
> 491)
> at
> com.sun.jersey.api.client.WebResource.handle(WebResource.java:561)
> at com.sun.jersey.api.client.WebResource.access
> $300(WebResource.java:69)
> at com.sun.jersey.api.client.WebResource
> $Builder.get(WebResource.java:451)
> at
> com
> .imc
> .ids
> .client.resources.SymbolResourceProxy.find(SymbolResourceProxy.java:
> 63)
> [... removed rest of stack trace...]
>
>
>
> The information in this e-mail is intended only for the person or
> entity to which it is addressed.
>
> It may contain confidential and /or privileged material. If someone
> other than the intended recipient should receive this e-mail, he /
> she shall not be entitled to read, disseminate, disclose or
> duplicate it.
>
> If you receive this e-mail unintentionally, please inform us
> immediately by "reply" and then delete it from your system. Although
> this information has been compiled with great care, neither IMC
> Financial Markets & Asset Management nor any of its related entities
> shall accept any responsibility for any errors, omissions or other
> inaccuracies in this information or for the consequences thereof,
> nor shall it be bound in any way by the contents of this e-mail or
> its attachments. In the event of incomplete or incorrect
> transmission, please return the e-mail to the sender and permanently
> delete this message and any attachments.
>
> Messages and attachments are scanned for all known viruses. Always
> scan attachments before opening them.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
> The information in this e-mail is intended only for the person or
> entity to which it is addressed.
>
> It may contain confidential and /or privileged material. If someone
> other than the intended recipient should receive this e-mail, he /
> she shall not be entitled to read, disseminate, disclose or
> duplicate it.
>
> If you receive this e-mail unintentionally, please inform us
> immediately by "reply" and then delete it from your system. Although
> this information has been compiled with great care, neither IMC
> Financial Markets & Asset Management nor any of its related entities
> shall accept any responsibility for any errors, omissions or other
> inaccuracies in this information or for the consequences thereof,
> nor shall it be bound in any way by the contents of this e-mail or
> its attachments. In the event of incomplete or incorrect
> transmission, please return the e-mail to the sender and permanently
> delete this message and any attachments.
>
> Messages and attachments are scanned for all known viruses. Always
> scan attachments before opening them.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>