tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: instanceof drives me nuts!
Date Fri, 31 Oct 2003 14:43:44 GMT

Howdy,

>As I didn't build the project, I am not so familiar with it and I
couldn't
>avoid to put some of the classes in several places (server, common,
>shared, WEB-INF of my apps....).

Don't do this, as it can lead to unpredictable classloading errors.
Keep everything you can in WEB-INF/lib, the rest in common/lib, but no
jar should be in both places.  And you probably don't need to put
anything at all of yours in the server classloader directories.
>Callback callback = getTheCallBackObject();
>
>if(callback instanceof ApplicationCallback) {
>        ((ApplicationCallback) callback).doSomething();
>}
>
>When I debug this part, the expression 'callback instanceof
>ApplicationCallback' is true, nevertheless if I step once, the code in
the
>if block is not executed !!!

If the doSomething is not executed, how do you know if clause evaluates
to true?  From the debugger I suppose?

You can also try the other way around,
callback.getClass().isAssignableFrom(ApplicationCallback.class), to see
what would happen.

>Has anybody experienced this kind of weird behaviour?

Strange.  I think I've had that happen once or twice, but I can't recall
the solution ;(  

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message