A LinkedHashMap is not a Set. Could that explain the class cast exception?

--tim

On Tue, Apr 19, 2011 at 7:13 AM, Steve Ferris <steve.fer...@forgerock.com>wrote:

> Hi,
>
> I have a custom class AMRecord which is being handled in an unexpected way.
>
> Two RESTlet calls:
>
>     @Get
>     public AMRecord read(String id) {
>
> and
>
>     @Get
>     public Set<AMRecord> readWithSecKey(String id) {
>
> Jackson can cope with AMRecord as the read call works, my client code looks
> like this:
>
>         ClientResource resource = new ClientResource(resourceUrl +
> "/read");
>         ReadResource readResource = resource.wrap(ReadResource.class);
>
>         AMRecord record = readResource.read("43478392743");
>
> I get back an AMRecord instance.
>
> But for the Set, on the client I get a class cast exception
>
>         ClientResource resource = new ClientResource(resourceUrl +
> "/readwithseckey");
>         ReadWithSecKeyResource secReadResource =
> resource.wrap(ReadWithSecKeyResource.class);
>
>         Set<AMRecord> sessions =
> secReadResource.readWithSecKey("uid=steve,ou=users,o=openam");
>
> This is because the Set sessions has a LinkedHashMap rather than AMRecord
> entries. The LinkedHashMap is populated with the data from the AMRecord that
> should be present.
>
> Any ideas?
>
> thanks
> Steve
>
> --
> Steve Ferris : ForgeRock AS : e: steve.fer...@forgerock.com
> t: +44 (0)7813 709285 f: +44 (0)7971 042421 w: forgerock.com
> OpenAM, the new name for OpenSSO
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2721412

Reply via email to