Hi everyone,

I assume there is a BUG in the JSP Code Compiler somewhere, because the
following does not work as it should:

[...]

<% 

// Retrieve user object for this session
Object obj = request.getSession().getAttribute("user");

// Just make sure, what class we have
System.out.println(obj.getClass().toString());

// Check instance, should return true.
if (obj instanceof some.User)
    currentUser = (somepkg.User) obj;
else
    System.out.println("WEIRD! How can that be???");

%>

User is the interface for describing a User and its properties, UserImpl is
the actual implementation. obj.getClass().toString() shows, that obj is
instance of somepkg.UserImpl, but instanceof returns false. Even if i try
"obj.instanceof somepkg.UserImpl" it fails. Casting throws a ClassCastException.

Can anyone verify this behaviour?

I am new to this list, so please apologize if this has been reported
already.
Thanks for any comment on this.

Bye,
 Levent.

Reply via email to