Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 13177 invoked from network); 30 Jul 2007 05:36:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jul 2007 05:36:50 -0000 Received: (qmail 10521 invoked by uid 500); 30 Jul 2007 05:36:50 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 10483 invoked by uid 500); 30 Jul 2007 05:36:50 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 10473 invoked by uid 99); 30 Jul 2007 05:36:50 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Jul 2007 22:36:50 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mprudhomapache@gmail.com designates 209.85.198.185 as permitted sender) Received: from [209.85.198.185] (HELO rv-out-0910.google.com) (209.85.198.185) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2007 05:36:44 +0000 Received: by rv-out-0910.google.com with SMTP id k20so353339rvb for ; Sun, 29 Jul 2007 22:36:24 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=cZas2GgMUH+X4rcZfShpHFlj9LASk57fiH9KFX8bOwnlc1yUWp+sbfmZFBHD/b+04eyLs+cV/K5ThHBydsGxZbatopxJU7BwcqDt677xdQLXA2N/0P781u6Ppdc+LRznIcZ8dsjPp4Q1jlKcF5e5HsNA7/d342ZiiudnYGoxCQg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=RUEIlD8IaO7995ohsDs4kMfhVVlevEnePNfFts5s1eJkN4LilvAhygmMj7/3qWQkC5Vs5pIvjZq0MqILz6iTC43C2SGaxXMWELoK8ZLLxzADtL/32MBjUMF9o4+f362E/OKTAuBx1AFhW4TPFpPLpg8YkavkbGGpBgFHckBdUjo= Received: by 10.141.88.3 with SMTP id q3mr1705512rvl.1185773783904; Sun, 29 Jul 2007 22:36:23 -0700 (PDT) Received: from ?192.168.1.10? ( [66.248.222.34]) by mx.google.com with ESMTPS id g39sm4240114rvb.2007.07.29.22.36.19 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 Jul 2007 22:36:20 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <89c0c52c0707292042o675755e7vf6956a145d936fc6@mail.gmail.com> References: <89c0c52c0707180800t686579faj9cd93fa488f6b1d3@mail.gmail.com> <89c0c52c0707180838n30568ca2i3a649111b0f2ed43@mail.gmail.com> <7262f25e0707180859k6bfad120kbf86b745eafa1436@mail.gmail.com> <469E74E0.9060202@Sun.COM> <89c0c52c0707182037raf912aay54d9d14fa9a3b915@mail.gmail.com> <469FAFA8.9070303@sun.com> <89c0c52c0707191158q17ecc7a5u84b029ecf3cc668c@mail.gmail.com> <89c0c52c0707292042o675755e7vf6956a145d936fc6@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8FA688DB-BB72-4566-9DCA-D5F1C6C11A98@apache.org> Content-Transfer-Encoding: 7bit From: Marc Prud'hommeaux Subject: Re: svn commit: r557089 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/ openjpa-lib/src/main/ja Date: Sun, 29 Jul 2007 22:35:52 -0700 To: dev@openjpa.apache.org X-Mailer: Apple Mail (2.752.3) Sender: Marc Prud'hommeaux X-Virus-Checked: Checked by ClamAV on apache.org Kevin- That is very odd! I also just reproduced the behavior you described (with Integer i = new Integer(1); Map map = new HashMap(); map.put(i, "x"); print(map.keySet().iterator().next() == i); ... it returns "false" for ibm-java2-i386-50, but "true" for Sun's and Apple's JRE). It looks to me like IBM's JRE might be doing special processing for Integer keys since it can short-circuit using hashCode buckets, and just go right ahead and use the Integer itself as the internal key. Or something like that. You are also correct that it doesn't seem to happen for any other primitive wrapper (I tried with Long and the above returned "true"). If we were feeling lazy, we could just swap out all the offending Integer keys with Longs and call it a day. Whether this is a bug with IBM's HashMap or not, I think we should probably fix it to use equals() correctly. Unfortunately, I don't really have much insight into what could be going wrong with other places where it might not doing proper equality comparison. Maybe just grepping for "==" in the code around Edge might shed some light on where we might be doing the wrong sort of equality checking? On Jul 29, 2007, at 8:42 PM, Kevin Sutter wrote: > I've been able to spend some time with this problem and have > figured out the > source of the problem. I would like some input on how to go about > fixing > it. > > The problem is that the IBM JDK seems to want to create (copy) new > Integer > objects when used as keys to the HashMap.put(k,v) method. Any > other key > types are just used as is (no copy). But, Integer types as keys > are copied > into new Integer objects. > > So, when the Edge.getOther(Node n) method attempts to match up with > either > the _from or _to node, neither of the conditionals returns true > because the > equality check is done via == instead of .equals(). > > I've looked through the javadoc for the HashMap and I can't tell > whether the > put(k,v) method has to use the input key or if it's okay to make a > copy of > the key. If making a copy is okay, then I would say that our > getOther(n) > method should be updated to use .equals instead of the == equality > checking. > > But, when I make this type of change, I am still failing the last > two tests > in TestDepthFirstAnalysis due to the assertions when checking for > the number > of edges for TYPE_BACK and TYPE_FORWARD. In testBackEdges, the > assertion is > expecting 2, but there are 3 edges detected. In testForwardEdges, the > assertion is expecting 2, but there is only 1 edge detected. There > must be > some other processing that is not expecting the new Integer objects > to be > created, but I haven't nailed that down yet. > > Thoughts on problems? > > Thanks, > Kevin > > On 7/19/07, Kevin Sutter wrote: >> >> Markus, >> No such luck. Still the same problem. Sorry that I can't be of more >> service at the moment -- busy with some other work activities... >> >> Running org.apache.openjpa.lib.graph.TestDepthFirstAnalysis >> DEBUG (init): node = java.lang.Object@3f563f56 info = >> org.apache.openjpa.lib.graph.NodeInfo@7c047c04 >> DEBUG (init): node = java.lang.Object@3f523f52 info = >> org.apache.openjpa.lib.graph.NodeInfo@7e807e80 >> DEBUG (init): node = java.lang.Object@3f5a3f5a info = >> org.apache.openjpa.lib.graph.NodeInfo@ba00ba >> DEBUG (init): node = java.lang.Object@3f4e3f4e info = >> org.apache.openjpa.lib.graph.NodeInfo@28c028c >> DEBUG (after init): node = java.lang.Object@3f563f56 info = >> org.apache.openjpa.lib.graph.NodeInfo@7c047c04 >> DEBUG (after init): node = java.lang.Object@3f523f52 info = >> org.apache.openjpa.lib.graph.NodeInfo@7e807e80 >> DEBUG (after init): node = java.lang.Object@3f5a3f5a info = >> org.apache.openjpa.lib.graph.NodeInfo@ba00ba >> DEBUG (after init): node = java.lang.Object@3f4e3f4e info = >> org.apache.openjpa.lib.graph.NodeInfo@28c028c >> DEBUG (visit): node = java.lang.Object@3f563f56 >> DEBUG (visit): other = java.lang.Object@3f4e3f4e otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@28c028c >> DEBUG (visit): node = java.lang.Object@3f4e3f4e >> DEBUG (visit): other = java.lang.Object@3f523f52 otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@7e807e80 >> DEBUG (visit): node = java.lang.Object@3f523f52 >> DEBUG (visit): other = java.lang.Object@3f563f56 otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@7c047c04 >> DEBUG (visit): other = java.lang.Object@3f523f52 otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@7e807e80 >> DEBUG (visit): other = java.lang.Object@3f5a3f5a otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@ba00ba >> DEBUG (visit): node = java.lang.Object@3f5a3f5a >> DEBUG (init): node = java.lang.Object@74bc74bc info = >> org.apache.openjpa.lib.graph.NodeInfo@757a757a >> DEBUG (init): node = java.lang.Object@74b874b8 info = >> org.apache.openjpa.lib.graph.NodeInfo@105a105a >> DEBUG (init): node = java.lang.Object@74b474b4 info = >> org.apache.openjpa.lib.graph.NodeInfo@12941294 >> DEBUG (init): node = java.lang.Object@74b074b0 info = >> org.apache.openjpa.lib.graph.NodeInfo@14661466 >> DEBUG (after init): node = java.lang.Object@74bc74bc info = >> org.apache.openjpa.lib.graph.NodeInfo@757a757a >> DEBUG (after init): node = java.lang.Object@74b874b8 info = >> org.apache.openjpa.lib.graph.NodeInfo@105a105a >> DEBUG (after init): node = java.lang.Object@74b474b4 info = >> org.apache.openjpa.lib.graph.NodeInfo@12941294 >> DEBUG (after init): node = java.lang.Object@74b074b0 info = >> org.apache.openjpa.lib.graph.NodeInfo@14661466 >> DEBUG (visit): node = java.lang.Object@74bc74bc >> DEBUG (visit): node = java.lang.Object@74b874b8 >> DEBUG (visit): other = java.lang.Object@74b074b0 otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@14661466 >> DEBUG (visit): node = java.lang.Object@74b074b0 >> DEBUG (visit): other = java.lang.Object@74b474b4 otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@12941294 >> DEBUG (visit): node = java.lang.Object@74b474b4 >> DEBUG (visit): other = java.lang.Object@74b874b8 otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@105a105a >> DEBUG (visit): other = java.lang.Object@74b474b4 otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@12941294 >> DEBUG (visit): other = java.lang.Object@74bc74bc otherInfo = >> org.apache.openjpa.lib.graph.NodeInfo@757a757a >> DEBUG (init): node = 5 info = >> org.apache.openjpa.lib.graph.NodeInfo@32f032f0 >> DEBUG (init): node = 4 info = >> org.apache.openjpa.lib.graph.NodeInfo@34d634d6 >> DEBUG (init): node = 3 info = >> org.apache.openjpa.lib.graph.NodeInfo@36603660 >> DEBUG (init): node = 2 info = >> org.apache.openjpa.lib.graph.NodeInfo@379a379a >> DEBUG (init): node = 1 info = >> org.apache.openjpa.lib.graph.NodeInfo@38d438d4 >> DEBUG (after init): node = 5 info = >> org.apache.openjpa.lib.graph.NodeInfo@32f032f0 >> DEBUG (after init): node = 4 info = >> org.apache.openjpa.lib.graph.NodeInfo@34d634d6 >> DEBUG (after init): node = 3 info = >> org.apache.openjpa.lib.graph.NodeInfo@36603660 >> DEBUG (after init): node = 2 info = >> org.apache.openjpa.lib.graph.NodeInfo@379a379a >> DEBUG (after init): node = 1 info = >> org.apache.openjpa.lib.graph.NodeInfo@38d438d4 >> DEBUG (visit): node = 5 >> DEBUG (visit): other = null otherInfo = null >> DEBUG (init): node = 5 info = >> org.apache.openjpa.lib.graph.NodeInfo@261c261c >> DEBUG (init): node = 4 info = >> org.apache.openjpa.lib.graph.NodeInfo@2f0e2f0e >> DEBUG (init): node = 3 info = >> org.apache.openjpa.lib.graph.NodeInfo@30983098 >> DEBUG (init): node = 2 info = >> org.apache.openjpa.lib.graph.NodeInfo@31d231d2 >> DEBUG (init): node = 1 info = >> org.apache.openjpa.lib.graph.NodeInfo@330c330c >> DEBUG (after init): node = 5 info = >> org.apache.openjpa.lib.graph.NodeInfo@261c261c >> DEBUG (after init): node = 4 info = >> org.apache.openjpa.lib.graph.NodeInfo@2f0e2f0e >> DEBUG (after init): node = 3 info = >> org.apache.openjpa.lib.graph.NodeInfo@30983098 >> DEBUG (after init): node = 2 info = >> org.apache.openjpa.lib.graph.NodeInfo@31d231d2 >> DEBUG (after init): node = 1 info = >> org.apache.openjpa.lib.graph.NodeInfo@330c330c >> DEBUG (visit): node = 5 >> DEBUG (visit): other = null otherInfo = null >> Tests run: 4, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: >> 0.015 sec >> <<< FAILURE! >> testBackEdges >> (org.apache.openjpa.lib.graph.TestDepthFirstAnalysis) Time >> elapsed: 0.015 sec <<< ERROR! >> java.lang.NullPointerException >> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.visit ( >> DepthFirstAnalysis.java:108) >> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.( >> DepthFirstAnalysis.java:83) >> at >> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.setUpGraph2 >> (TestDepthFirstAnalysis.java :88) >> at >> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.testBackEdges( >> TestDepthFirstAnalysis.java:117) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >> Method) >> at sun.reflect.NativeMethodAccessorImpl.invoke ( >> NativeMethodAccessorImpl.java:64) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >> DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:615) >> at junit.framework.TestCase.runTest (TestCase.java:154) >> at junit.framework.TestCase.runBare(TestCase.java:127) >> at junit.framework.TestResult$1.protect(TestResult.java:106) >> at junit.framework.TestResult.runProtected >> (TestResult.java :124) >> at junit.framework.TestResult.run(TestResult.java:109) >> at junit.framework.TestCase.run(TestCase.java:118) >> at org.apache.openjpa.lib.test.AbstractTestCase.run( >> AbstractTestCase.java:178) >> at junit.framework.TestSuite.runTest(TestSuite.java:208) >> at junit.framework.TestSuite.run(TestSuite.java:203) >> at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown >> Source) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >> DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:615) >> at org.apache.maven.surefire.junit.JUnitTestSet.execute( >> JUnitTestSet.java :210) >> at >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes >> tSet( >> AbstractDirectoryTestSuite.java:135) >> at >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute( >> AbstractDirectoryTestSuite.java :122) >> at org.apache.maven.surefire.Surefire.run(Surefire.java:129) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >> Method) >> at sun.reflect.NativeMethodAccessorImpl.invoke( >> NativeMethodAccessorImpl.java :64) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >> DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:615) >> at >> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess ( >> SurefireBooter.java:225) >> at org.apache.maven.surefire.booter.SurefireBooter.main( >> SurefireBooter.java:747) >> >> testForwardEdges(org.apache.openjpa.lib.graph.TestDepthFirstAnalysis) >> Time elapsed: 0 sec <<< ERROR! >> java.lang.NullPointerException >> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.visit( >> DepthFirstAnalysis.java:108) >> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.( >> DepthFirstAnalysis.java :83) >> at >> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.setUpGraph2 >> (TestDepthFirstAnalysis.java:88) >> at >> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.testForwardEdges( >> TestDepthFirstAnalysis.java :141) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >> Method) >> at sun.reflect.NativeMethodAccessorImpl.invoke( >> NativeMethodAccessorImpl.java:64) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke ( >> DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:615) >> at junit.framework.TestCase.runTest(TestCase.java:154) >> at junit.framework.TestCase.runBare(TestCase.java :127) >> at junit.framework.TestResult$1.protect(TestResult.java:106) >> at junit.framework.TestResult.runProtected(TestResult.java: >> 124) >> at junit.framework.TestResult.run(TestResult.java:109) >> at junit.framework.TestCase.run(TestCase.java:118) >> at org.apache.openjpa.lib.test.AbstractTestCase.run( >> AbstractTestCase.java:178) >> at junit.framework.TestSuite.runTest(TestSuite.java:208) >> at junit.framework.TestSuite.run(TestSuite.java:203) >> at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown >> Source) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >> DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:615) >> at org.apache.maven.surefire.junit.JUnitTestSet.execute( >> JUnitTestSet.java:210) >> at >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes >> tSet( >> AbstractDirectoryTestSuite.java:135) >> at >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute( >> AbstractDirectoryTestSuite.java:122) >> at org.apache.maven.surefire.Surefire.run(Surefire.java :129) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >> Method) >> at sun.reflect.NativeMethodAccessorImpl.invoke( >> NativeMethodAccessorImpl.java:64) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke ( >> DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:615) >> at >> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess( >> SurefireBooter.java:225) >> at org.apache.maven.surefire.booter.SurefireBooter.main( >> SurefireBooter.java:747) >> >> >> On 7/19/07, Markus Fuchs wrote: >> >>> Kevin, >>> >>> the failure might be caused by the field _dfa being initialized >>> twice, >>> once in setUp and again in testBackEdges/testForwardEdges. Please >>> try >>> the attached patch to resolve the problem. >>> >>> Thanks, >>> >>> -- markus. >>> >>> Kevin Sutter wrote: >>>> Markus, >>>> Here's the output after applying your diagnostic patch: Hope it >>> helps! >>>> >>>> Running org.apache.openjpa.lib.graph.TestDepthFirstAnalysis >>>> DEBUG (init): node = java.lang.Object@22a422a4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@44e044e0 >>>> DEBUG (init): node = java.lang.Object@22a022a0 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@473c473c >>>> DEBUG (init): node = java.lang.Object@229c229c info = >>>> org.apache.openjpa.lib.graph.NodeInfo@52145214 >>>> DEBUG (init): node = java.lang.Object@22982298 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@53e653e6 >>>> DEBUG (after init): node = java.lang.Object@22a422a4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@44e044e0 >>>> DEBUG (after init): node = java.lang.Object@22a022a0 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@473c473c >>>> DEBUG (after init): node = java.lang.Object@229c229c info = >>>> org.apache.openjpa.lib.graph.NodeInfo@52145214 >>>> DEBUG (after init): node = java.lang.Object@22982298 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@53e653e6 >>>> DEBUG (visit): node = java.lang.Object@22a422a4 >>>> DEBUG (visit): node = java.lang.Object@22a022a0 >>>> DEBUG (visit): other = java.lang.Object@22982298 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@53e653e6 >>>> DEBUG (visit): node = java.lang.Object@22982298 >>>> DEBUG (visit): other = java.lang.Object@229c229c otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@52145214 >>>> DEBUG (visit): node = java.lang.Object@229c229c >>>> DEBUG (visit): other = java.lang.Object@22a022a0 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@473c473c >>>> DEBUG (visit): other = java.lang.Object@229c229c otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@52145214 >>>> DEBUG (visit): other = java.lang.Object@22a422a4 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@44e044e0 >>>> DEBUG (init): node = java.lang.Object@32643264 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@33263326 >>>> DEBUG (init): node = java.lang.Object@32603260 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@354c354c >>>> DEBUG (init): node = java.lang.Object@32683268 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@37863786 >>>> DEBUG (init): node = java.lang.Object@325c325c info = >>>> org.apache.openjpa.lib.graph.NodeInfo@3a2c3a2c >>>> DEBUG (after init): node = java.lang.Object@32643264 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@33263326 >>>> DEBUG (after init): node = java.lang.Object@32603260 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@354c354c >>>> DEBUG (after init): node = java.lang.Object@32683268 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@37863786 >>>> DEBUG (after init): node = java.lang.Object@325c325c info = >>>> org.apache.openjpa.lib.graph.NodeInfo@3a2c3a2c >>>> DEBUG (visit): node = java.lang.Object@32643264 >>>> DEBUG (visit): other = java.lang.Object@325c325c otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@3a2c3a2c >>>> DEBUG (visit): node = java.lang.Object@325c325c >>>> DEBUG (visit): other = java.lang.Object@32603260 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@354c354c >>>> DEBUG (visit): node = java.lang.Object@32603260 >>>> DEBUG (visit): other = java.lang.Object@32643264 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@33263326 >>>> DEBUG (visit): other = java.lang.Object@32603260 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@354c354c >>>> DEBUG (visit): other = java.lang.Object@32683268 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@37863786 >>>> DEBUG (visit): node = java.lang.Object@32683268 >>>> DEBUG (init): node = java.lang.Object@71a471a4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@726e726e >>>> DEBUG (init): node = java.lang.Object@71ac71ac info = >>>> org.apache.openjpa.lib.graph.NodeInfo@74947494 >>>> DEBUG (init): node = java.lang.Object@71a871a8 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@33fc33fc >>>> DEBUG (init): node = java.lang.Object@71b071b0 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@38003800 >>>> DEBUG (after init): node = java.lang.Object@71a471a4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@726e726e >>>> DEBUG (after init): node = java.lang.Object@71ac71ac info = >>>> org.apache.openjpa.lib.graph.NodeInfo@74947494 >>>> DEBUG (after init): node = java.lang.Object@71a871a8 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@33fc33fc >>>> DEBUG (after init): node = java.lang.Object@71b071b0 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@38003800 >>>> DEBUG (visit): node = java.lang.Object@71a471a4 >>>> DEBUG (visit): other = java.lang.Object@71a871a8 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@33fc33fc >>>> DEBUG (visit): node = java.lang.Object@71a871a8 >>>> DEBUG (visit): other = java.lang.Object@71ac71ac otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@74947494 >>>> DEBUG (visit): node = java.lang.Object@71ac71ac >>>> DEBUG (visit): other = java.lang.Object@71a471a4 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@726e726e >>>> DEBUG (visit): other = java.lang.Object@71b071b0 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@38003800 >>>> DEBUG (visit): node = java.lang.Object@71b071b0 >>>> DEBUG (visit): other = java.lang.Object@71a871a8 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@33fc33fc >>>> DEBUG (init): node = 5 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@a340a34 >>>> DEBUG (init): node = 4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@ec80ec8 >>>> DEBUG (init): node = 3 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@10021002 >>>> DEBUG (init): node = 2 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@113c113c >>>> DEBUG (init): node = 1 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@2a522a52 >>>> DEBUG (after init): node = 5 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@a340a34 >>>> DEBUG (after init): node = 4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@ec80ec8 >>>> DEBUG (after init): node = 3 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@10021002 >>>> DEBUG (after init): node = 2 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@113c113c >>>> DEBUG (after init): node = 1 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@2a522a52 >>>> DEBUG (visit): node = 5 >>>> DEBUG (visit): other = null otherInfo = null >>>> DEBUG (init): node = java.lang.Object@7bc27bc2 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@25a625a6 >>>> DEBUG (init): node = java.lang.Object@7bbe7bbe info = >>>> org.apache.openjpa.lib.graph.NodeInfo@27cc27cc >>>> DEBUG (init): node = java.lang.Object@7bba7bba info = >>>> org.apache.openjpa.lib.graph.NodeInfo@2fda2fda >>>> DEBUG (init): node = java.lang.Object@7bb67bb6 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@31d231d2 >>>> DEBUG (after init): node = java.lang.Object@7bc27bc2 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@25a625a6 >>>> DEBUG (after init): node = java.lang.Object@7bbe7bbe info = >>>> org.apache.openjpa.lib.graph.NodeInfo@27cc27cc >>>> DEBUG (after init): node = java.lang.Object@7bba7bba info = >>>> org.apache.openjpa.lib.graph.NodeInfo@2fda2fda >>>> DEBUG (after init): node = java.lang.Object@7bb67bb6 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@31d231d2 >>>> DEBUG (visit): node = java.lang.Object@7bc27bc2 >>>> DEBUG (visit): node = java.lang.Object@7bbe7bbe >>>> DEBUG (visit): other = java.lang.Object@7bb67bb6 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@31d231d2 >>>> DEBUG (visit): node = java.lang.Object@7bb67bb6 >>>> DEBUG (visit): other = java.lang.Object@7bba7bba otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@2fda2fda >>>> DEBUG (visit): node = java.lang.Object@7bba7bba >>>> DEBUG (visit): other = java.lang.Object@7bbe7bbe otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@27cc27cc >>>> DEBUG (visit): other = java.lang.Object@7bba7bba otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@2fda2fda >>>> DEBUG (visit): other = java.lang.Object@7bc27bc2 otherInfo = >>>> org.apache.openjpa.lib.graph.NodeInfo@25a625a6 >>>> DEBUG (init): node = 5 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@163a163a >>>> DEBUG (init): node = 4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@19b219b2 >>>> DEBUG (init): node = 3 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@26782678 >>>> DEBUG (init): node = 2 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@27b627b6 >>>> DEBUG (init): node = 1 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@31283128 >>>> DEBUG (after init): node = 5 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@163a163a >>>> DEBUG (after init): node = 4 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@19b219b2 >>>> DEBUG (after init): node = 3 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@26782678 >>>> DEBUG (after init): node = 2 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@27b627b6 >>>> DEBUG (after init): node = 1 info = >>>> org.apache.openjpa.lib.graph.NodeInfo@31283128 >>>> DEBUG (visit): node = 5 >>>> DEBUG (visit): other = null otherInfo = null >>>> Tests run: 4, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: >>>> 0.016sec >>>> <<< FAILURE! >>>> testBackEdges >>>> (org.apache.openjpa.lib.graph.TestDepthFirstAnalysis) Time >>>> elapsed: 0.016 sec <<< ERROR! >>>> java.lang.NullPointerException >>>> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.visit( >>>> DepthFirstAnalysis.java:108) >>>> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.( >>>> DepthFirstAnalysis.java:83) >>>> at >>>> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.setUpGraph2( >>>> TestDepthFirstAnalysis.java :78) >>>> at >>>> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.testBackEdges >>>> (TestDepthFirstAnalysis.java:105) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >>>> Method) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke( >>>> NativeMethodAccessorImpl.java:64) >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>>> DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke (Method.java:615) >>>> at junit.framework.TestCase.runTest(TestCase.java:154) >>>> at junit.framework.TestCase.runBare(TestCase.java:127) >>>> at junit.framework.TestResult$1.protect(TestResult.java : >>>> 106) >>>> at junit.framework.TestResult.runProtected >>>> (TestResult.java:124) >>>> at junit.framework.TestResult.run(TestResult.java:109) >>>> at junit.framework.TestCase.run(TestCase.java:118) >>>> at org.apache.openjpa.lib.test.AbstractTestCase.run( >>>> AbstractTestCase.java:178) >>>> at junit.framework.TestSuite.runTest(TestSuite.java:208) >>>> at junit.framework.TestSuite.run(TestSuite.java :203) >>>> at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown >>>> Source) >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>>> DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke (Method.java:615) >>>> at org.apache.maven.surefire.junit.JUnitTestSet.execute( >>>> JUnitTestSet.java:210) >>>> at >>>> >>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTe >>> stSet( >>> >>>> >>>> AbstractDirectoryTestSuite.java:) >>>> at >>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute( >>>> AbstractDirectoryTestSuite.java:122) >>>> at org.apache.maven.surefire.Surefire.run (Surefire.java: >>>> 129) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >>>> Method) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke( >>>> NativeMethodAccessorImpl.java:64) >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>>> DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke(Method.java:615) >>>> at >>>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess >>>> ( >>>> SurefireBooter.java:225) >>>> at org.apache.maven.surefire.booter.SurefireBooter.main( >>>> SurefireBooter.java:747) >>>> >>>> testForwardEdges >>>> (org.apache.openjpa.lib.graph.TestDepthFirstAnalysis ) >>>> Time >>>> elapsed: 0 sec <<< ERROR! >>>> java.lang.NullPointerException >>>> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.visit( >>>> DepthFirstAnalysis.java:108) >>>> at org.apache.openjpa.lib.graph.DepthFirstAnalysis.( >>>> DepthFirstAnalysis.java:83) >>>> at >>>> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.setUpGraph2( >>>> TestDepthFirstAnalysis.java :78) >>>> at >>>> org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.testForwardEdge >>>> s( >>>> TestDepthFirstAnalysis.java:129) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >>>> Method) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke( >>>> NativeMethodAccessorImpl.java:64) >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>>> DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke(Method.java:615) >>>> at junit.framework.TestCase.runTest(TestCase.java:154) >>>> at junit.framework.TestCase.runBare(TestCase.java:127) >>>> at junit.framework.TestResult$1.protect (TestResult.java: >>>> 106) >>>> at junit.framework.TestResult.runProtected >>>> (TestResult.java:124) >>>> at junit.framework.TestResult.run(TestResult.java:109) >>>> at junit.framework.TestCase.run(TestCase.java :118) >>>> at org.apache.openjpa.lib.test.AbstractTestCase.run( >>>> AbstractTestCase.java:178) >>>> at junit.framework.TestSuite.runTest(TestSuite.java:208) >>>> at junit.framework.TestSuite.run (TestSuite.java:203) >>>> at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown >>>> Source) >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>>> DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke(Method.java:615) >>>> at org.apache.maven.surefire.junit.JUnitTestSet.execute( >>>> JUnitTestSet.java:210) >>>> at >>>> >>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTe >>> stSet( >>>> >>>> AbstractDirectoryTestSuite.java:) >>>> at >>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute( >>>> AbstractDirectoryTestSuite.java:122) >>>> at org.apache.maven.surefire.Surefire.run (Surefire.java: >>>> 129) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >>>> Method) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke( >>>> NativeMethodAccessorImpl.java:64) >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>>> DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke(Method.java:615) >>>> at >>>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess >>>> ( >>>> SurefireBooter.java:225) >>>> at org.apache.maven.surefire.booter.SurefireBooter.main( >>>> SurefireBooter.java:747) >>>> >>>> >>>> On 7/18/07, Markus Fuchs < Markus.Fuchs@sun.com> wrote: >>>>> >>>>> Thanks Marc. I added debug statements the the code accessing the >>>>> _nodeInfo Map. Could somebody please try the attached patch! >>>>> >>>>> -- markus. >>>>> >>>>> Marc Prud'hommeaux wrote: >>>>>> >>>>>> As a random shot in the dark (I can't reproduce the error on my >>>>>> machine), I notice that the _nodeInfo Map is relying on keys >>>>>> being >>> of >>>>>> type java.util.Collection, and the javadoc for >>>>>> Collection.equals() >>>>>> does not actually require that equality be evaluated based on the >>>>>> content of the collection (although java.util.List.equals() >>>>>> does). >>>>>> >>>>>> So if somehow there is an IBM-specific list that is being put in >>> there >>>>>> as a key, then a lookup using an equivalent collection might >>>>>> not be >>>>>> succeeding, resulting in _nodeInfo.get(other) returning null. >>>>>> >>>>>> Anyway, just a guess. Some debug statements would very quickly >>>>>> show >>> it >>>>>> that might be the case or not. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Jul 18, 2007, at 8:59 AM, Patrick Linskey wrote: >>>>>> >>>>>>> From the source: >>>>>>> >>>>>>>> otherInfo = (NodeInfo) _nodeInfo.get(other); >>>>>>>> if (otherInfo.color == NodeInfo.COLOR_WHITE) { >>>>>>> >>>>>>> Assuming that the class constant is non-null, that leaves >>> otherInfo. >>>>>>> _nodeInfo is populated during construction based on the graph >>> passed >>>>>>> to the constructor. It looks like the null must be coming from >>>>>>> Graph.java:154 or Graph.java :162. >>>>>>> >>>>>>> -Patrick >>>>>>> >>>>>>> On 7/18/07, Craig L Russell wrote: >>>>>>>> So it's either a bug in the IBM vm or a bug in our code that >>>>> exploits >>>>>>>> some loophole in the spec that the Sun JDK doesn't fail on... >>>>>>>> >>>>>>>> Craig >>>>>>>> >>>>>>>> On Jul 18, 2007, at 8:38 AM, Kevin Sutter wrote: >>>>>>>> >>>>>>>>> Yes, and the Sun JDK works just fine. So, for the majority of >>> the >>>>>>>>> folks, >>>>>>>>> there is no problem... :-( >>>>>>>>> >>>>>>>>> On 7/18/07, Craig L Russell wrote: >>>>>>>>>> >>>>>>>>>> I don't suppose you have run this with the Sun JDK (that I've >>>>> tested >>>>>>>>>> on). >>>>>>>>>> >>>>>>>>>> Craig >>>>>>>>>> >>>>>>>>>> On Jul 18, 2007, at 8:00 AM, Kevin Sutter wrote: >>>>>>>>>> >>>>>>>>>>> Craig, >>>>>>>>>>> I haven't taken the time to figure out the source of the >>>>> problem >>>>>>>>>>> yet, but I >>>>>>>>>>> am experiencing two NPE's in our test bucket when running >>> with >>>>> the >>>>>>>>>>> IBM JDK ( >>>>>>>>>>> 1.5.0 SR5). I thought I would post a heads-up for any IBM >>> JDK >>>>>>>>>>> users... >>>>>>>> >>>>>>>> Craig Russell >>>>>>>> Architect, Sun Java Enterprise System >>>>> http://java.sun.com/products/jdo >>>>>>>> 408 276-5638 mailto:Craig.Russell@sun.com >>>>>>>> P.S. A good JDO? O, Gasp! >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> --Patrick Linskey >>>>>>> 202 669 5907 >>>>>> >>>>> >>>>> >>>> >>> >>> Index: >>> openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/ >>> TestDepthFirstAnalysis.java >>> =================================================================== >>> --- >>> openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/ >>> TestDepthFirstAnalysis.java (revision >>> 557093) >>> +++ >>> openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/ >>> TestDepthFirstAnalysis.java (working >>> copy) >>> @@ -35,7 +35,6 @@ >>> private DepthFirstAnalysis _dfa = null; >>> >>> public void setUp() { >>> - setUpGraph1(); >>> } >>> >>> public void setUpGraph1() { >>> @@ -58,30 +57,30 @@ >>> >>> public void setUpGraph2() { >>> Graph graph = new Graph(); >>> - Integer node1 = new Integer(5); >>> - Integer node2 = new Integer(4); >>> + Integer node5 = new Integer(5); >>> + Integer node4 = new Integer(4); >>> Integer node3 = new Integer(3); >>> - Integer node4 = new Integer(2); >>> - Integer node5 = new Integer(1); >>> + Integer node2 = new Integer(2); >>> + Integer node1 = new Integer(1); >>> + graph.addNode(node5); >>> + graph.addNode(node4); >>> + graph.addNode(node3); >>> + graph.addNode(node2); >>> graph.addNode(node1); >>> - graph.addNode(node2); >>> - graph.addNode(node3); >>> - graph.addNode(node4); >>> - graph.addNode(node5); >>> - graph.addEdge(new Edge(node1, node2, true)); >>> - graph.addEdge(new Edge(node2, node3, true)); >>> + graph.addEdge(new Edge(node5, node4, true)); >>> + graph.addEdge(new Edge(node4, node3, true)); >>> graph.addEdge(new Edge(node3, node3, true)); >>> - graph.addEdge(new Edge(node3, node4, true)); >>> - graph.addEdge(new Edge(node4, node1, true)); >>> - graph.addEdge(new Edge(node4, node2, true)); >>> - graph.addEdge(new Edge(node5, node2, true)); >>> + graph.addEdge(new Edge(node3, node2, true)); >>> + graph.addEdge(new Edge(node2, node5, true)); >>> + graph.addEdge(new Edge(node2, node4, true)); >>> + graph.addEdge(new Edge(node1, node4, true)); >>> _dfa = new DepthFirstAnalysis(graph); >>> } >>> >>> public void testNodeSorting() { >>> + setUpGraph1(); >>> Collection nodes = _dfa.getSortedNodes(); >>> assertEquals(4, nodes.size ()); >>> - >>> int time = 0; >>> Object node; >>> for (Iterator itr = nodes.iterator(); itr.hasNext();) { >>> @@ -92,6 +91,7 @@ >>> } >>> >>> public void testEdgeTyping() { >>> + setUpGraph1(); >>> Collection edges = _dfa.getEdges(Edge.TYPE_BACK); >>> assertEquals(2, edges.size()); >>> Iterator itr = edges.iterator(); >>> >>> >>