Return-Path: Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 57683 invoked from network); 25 Feb 2003 18:21:08 -0000 Received: from smtp03.web.de (HELO smtp.web.de) (217.72.192.158) by daedalus.apache.org with SMTP; 25 Feb 2003 18:21:08 -0000 Received: from dialin-145-254-090-249.arcor-ip.net ([145.254.90.249] helo=web.de) by smtp.web.de with asmtp (WEB.DE(Exim) 4.95 #31) id 18njhW-0006sk-00 for ojb-dev@db.apache.org; Tue, 25 Feb 2003 19:21:10 +0100 Message-ID: <3E5BB418.5090700@web.de> Date: Tue, 25 Feb 2003 19:21:12 +0100 From: Thomas Mahler Reply-To: thma@apache.org Organization: Apache Foundation User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020903 X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List Subject: Re: NullPointer in SqlBasedRsIterator issue References: <3E5B9552.9030300@alma.nu> X-Enigmail-Version: 0.63.3.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: thma32@web.de X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Per, I'll have a look at it. Per-Olof Nor�n wrote: > Hi All, > I think a have found a bug in SqlBasedRsIterator > > Scenario: Using fresch cvs checkout, SingleVM broker: > > When calling: > String query = "select * from a_mapped_table where bla bla"; > Collection collection = broker.getCollectionByQuery(query); > One gets: > java.lang.NullPointerException > at > org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:399) > > at > org.apache.ojb.broker.accesslayer.SqlBasedRsIterator.getObjectFromResultSet(SqlBasedRsIterator.java:110) > > at > org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:235) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1284) > > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1410) > > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1456) > > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1443) > > at > org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:310) > > > Which happens because SqlBasedRsIterator never explicitly calls the > constructor of RsIterator and never assigns the protected cache member > in rsIterator. > I have copied the snippet of code from RsIterator that assigns the cache > and placed it in the constructor of SqlBasedRsIterator: > cache = broker.serviceObjectCache(); > > This solved seems to have solved the problem. > I can send a patch for this if it�s the correct way of solving the > troubles. > > ps > I recently sent another patch: > http://archives.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@jakarta.apache.org&msgNo=3688 > > on which I haven�t got *any* input on, surely this project is accepting > any help it can get? Sure! I'll have a look at that fix too. thanks, Thomas > ds > > Regards, > Per-Olof Nor�n > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > >