Has anybody ever seen anything like this? We're running a process (Websphere, actually, with an application in it) on java 1.3 hotspot (build 1.3.1_03-b03 to be specific). After the application has been up and running for a long time we start getting a peculiar error. One possible explanation for the error would be if the equals() method on Integer were failing (returning false for two Integers both containing 0). Has anyone ever heard of such a thing? It's a pretty ridiculous idea, but at the moment my other possible explanations are looking a bit ridiculous also, so I thought I'd ask. -- Michael Chermside
author and iconoclast
It's not absolutely impossible, I suppose. The code for Integer.equals() is
So if you had two different instances of Integer, each one an instance of a version of the class loaded from two different class loaders, then this could return false regardless of the numeric values -- the instanceof would fail. Normally, system classes should never be loaded by user classloaders. But app servers use lots of custom loaders, and a badly written or badly configured one might accidentally do such a thing, so if it's ever going to happen, it would be in an app server.