Hi,
I have a java based-simulation that contains the following code :
EDProtocol prot = null;
boolean check=false;
try {
*prot = (EDProtocol) ev.node.getProtocol(pid);*
prot.processEvent(ev.node, pid, ev.event);
*check= (ev.node.getProtocol(pid) instanceof DRingProtocol);*
} catch (ClassCastException e) {
throw new IllegalArgumentException("class: "+ ev.node.getProtocol(pid).getClass()+ "; is instance of DRingProtocol: "+ check);
}
However, sometimes I get this weird error:
"Exception in thread "main" java.lang.IllegalArgumentException: Class: DRingProtocol; is instance of DRingProtocol; false"
How can "prot" not be an instance of its class???
Thanks
Mannous