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 41188 invoked from network); 31 Mar 2003 15:39:59 -0000 Received: from unknown (HELO eng.werken.com) (66.216.68.111) by daedalus.apache.org with SMTP; 31 Mar 2003 15:39:59 -0000 Received: from eng.werken.com (localhost [127.0.0.1]) by eng.werken.com (8.11.6/8.11.6) with ESMTP id h2VGxwd07840; Mon, 31 Mar 2003 10:59:59 -0600 Message-ID: <4551044.1049129998911.JavaMail.jmcnally@localhost> Date: Mon, 31 Mar 2003 10:59:58 -0600 (CST) From: Oliver Matz Reply-To: Scarab Admistrator To: Oliver Matz Subject: [OJB] Issue #OJB153 - NPE in TransactionImpl.assertFkAssignment (Null references a... Cc: "ojb-dev@db.apache.org" Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N You can view the issue detail at the following URL: Type : Defect Issue Id : OJB153 Reported by: Oliver Matz oliverm - (oliver.matz@ppi.de) Details: Platform: All Operating system: windows 2000 Summary: NPE in TransactionImpl.assertFkAssignment (Null references and proxies) Description: Suppose class A has a proxy reference b of type B. Suppose that the database schema does not have a foreign key constraint for the corresponding columns. If an instance a of class A is retrieved from the database and there is no corresponding B value, then the a.b will be instatiated as a virtual proxy, and the first access to a field might result in a NullPointerException. First variant where this happens is when Transaction.lock(a, ...) is called. Stacktrace: java.lang.NullPointerException at org.apache.ojb.odmg.TransactionImpl.assertFkAssignment(TransactionImpl.java:812) at org.apache.ojb.odmg.TransactionImpl.assignReferenceFKs(TransactionImpl.java:853) at org.apache.ojb.odmg.TransactionImpl.lock(TransactionImpl.java:260) Second variant: A getter is called. Stacktrace: at org.apache.ojb.broker.accesslayer.IndirectionHandler.invoke(IndirectionHandler.java:256) at $Proxy0.getName(Unknown Source) at org.apache.ojb.broker.AbstractArticle.toString(AbstractArticle.java:10) at java.lang.String.valueOf(String.java:2177) at java.lang.StringBuffer.append(StringBuffer.java:361) at org.apache.ojb.odmg.NullProxyTest.testWithNullAccess(NullProxyTest.java:92) A potential fix, which solves the first variant, is attached. Writing a test-case for this problem requires to introduce new tables in the junit datbase schema, because currently the above situation cannot be established due to integrity constaints. See attached file NullProxyTest.java Status: Unconfirmed