Re: NPE caught in handleClientEvent in latest cvs-version

Leo Mekenkamp <[email protected]> Sat, 21 Aug 2004 22:53:01 +0200
Newsgroups gmane.comp.java.ozone.user
Message-ID <1093121580.3997.3.camel@jupiter>
On Sat, 2004-08-21 at 22:50, Arjen van der Meijden wrote:
> On 21-8-2004 22:27, Leo Mekenkamp wrote:
> > On Sat, 2004-08-21 at 15:32, Arjen van der Meijden wrote:
> > 
> >>I've adjusted the code of Ozone's InvokeServer (and a proxy of mine) to 
> >>get the stacktrace of the NPE, here it is:
> > 
> > 
> > Do you happen to have a minimal code set that will show the npe when
> > being run against an empty db? If so, please send it.
> > 
> > (...)
> 
> This is untested, but derived from expectancy of the code's behaviour 
> and the way my code handles things:
> 
> public interface TestNPE extends OzoneProxy
> {
>     public String toString();
> }
> 
> public class TestNPEImpl extends OzoneObject implements TestNPE
> {
>     public String toString(){return "TestNPEImpl";}
>     // You probably could even use Object's default-toString
> }
> 
> And then call something like:
> 
> OzoneMap ozoneMap = db.createObject(NodeTreeMapImpl.class, "testmap");
> // We need to have this class to be returned as a method-result, so 
> stick it into an OzoneMap.
> // You could also make another wrapper-class that simply creates the 
> object and returns it.
> TestNPE testNPE = db.createObject(TestNPEImpl.class);
> 
> ozoneMap.put("testNPE", testNPE);
> ozoneMap.get("testNPE");
> // Here it'll fetch the NPE, since the TestNPE-object will be the cmd.result
> 
> 
> The log-statement at InvokeServer's line 92 log.fine("..." + cmd.result 
> + "...");
> Will call the result-object's toString and that happens to be the 
> Proxied-version of toString, which causes a NPE in the 
> database.fetch-statement's call on the "current transaction".
> 
> I've now commented out that log-line in InvokeServer and Ozone works 
> fine and since the StackTrace showed it was comming from that line... 
> Anyway that is of course a workaround, not a fix.

I'll have a look at it tomorrow, but instinct tells me your solution is
probably closer to a fix than a workaround.

> Btw, the 1.2.x-dev version is more than twice as fast as the 
> 1.2-release, as far as I've tested it :)

Wieslaw sure found some interesting things :-)

Cheers,
Leo

-- 
Leo Mekenkamp; phone: +31 641234919
Care about freedom and innovation? http://openoffice.org,
http://ozone-db.org, http://mozilla.org, http://linux.org



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285