Re: getting a java.lang.ClassCastException

36 views
Skip to first unread message

Mario Fusco

unread,
Jan 16, 2013, 2:49:02 AM1/16/13
to lam...@googlegroups.com
Which version of lambdaj are you using?

On Wed, Jan 16, 2013 at 12:25 AM, Stephen Baker <bakers...@gmail.com> wrote:
To keep this short, I have the following method:

public static List<AgeOfMinecraftXrefItem> FindByAgeOfMinecraftItemType(List<AgeOfMinecraftXrefItem> xrefItems, String ageOfMinecraftItemType)
{
return select(xrefItems, having(on(AgeOfMinecraftXrefItem.class).getAgeOfMinecraftItemType(), equalTo(ageOfMinecraftItemType)));
}

And when the method is invoked with a list of items and a valid item type, the following exception is thrown:

Caused by: java.lang.ClassCastException
        at java.lang.Class.cast(Unknown Source)
        at ch.lambdaj.proxy.ClassImposterizer.imposterise(ClassImposterizer.java
:101)
        at ch.lambdaj.proxy.ProxyUtil.createProxy(ProxyUtil.java:52)
        at ch.lambdaj.function.argument.ArgumentsFactory.createPlaceholder(Argum
entsFactory.java:68)
        at ch.lambdaj.function.argument.ArgumentsFactory.registerNewArgument(Arg
umentsFactory.java:58)
        at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(Argument
sFactory.java:50)
        at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(Argument
sFactory.java:39)
        at ch.lambdaj.Lambda.on(Lambda.java:63)
        at bakersoft.ageofminecraft.data.entities.AgeOfMinecraftXrefItem.FindByA
geOfMinecraftItemType(AgeOfMinecraftXrefItem.java:95)


I have other classes that do exactly the same thing and yet I get no exception for those. This class does not extend any other class or implement any interfaces. Can someone point me in a direction here?

Stephen Baker

unread,
Jan 16, 2013, 5:57:39 AM1/16/13
to lam...@googlegroups.com
I apologize for forgetting that part. I am using version 2.4.

Mario Fusco

unread,
Jan 16, 2013, 6:08:29 AM1/16/13
to lam...@googlegroups.com
Ok. I need to reproduce this issue to figure out what's going on. It would be very helpful if could you send a unit test reproducing the problem.

Thanks,
Mario

Stephen Baker

unread,
Jan 17, 2013, 5:20:45 AM1/17/13
to lam...@googlegroups.com
That was my dilemma; re-creating this issue. I created a separate project trying to duplicate this as best as I could and could not. Finally, when talking out loud about my issue with a friend, I mentioned that I had not rebooted my development machine in quite sometime. I did that last night and believe it or not, this problem went away! So I guess you can say this was a false alarm.

Thanks for responding as quickly as you did and I have enjoyed your product to-date.
Reply all
Reply to author
Forward
0 new messages