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 = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (init): node = 5 info = [EMAIL PROTECTED] DEBUG (init): node = 4 info = [EMAIL PROTECTED] DEBUG (init): node = 3 info = [EMAIL PROTECTED] DEBUG (init): node = 2 info = [EMAIL PROTECTED] DEBUG (init): node = 1 info = [EMAIL PROTECTED]
DEBUG (after init): node = 5 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 4 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 3 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 2 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 1 info =
[EMAIL PROTECTED]
DEBUG (visit): node = 5
DEBUG (visit): other = null otherInfo = null
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (after init): node = [EMAIL PROTECTED] info =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): node = [EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (visit): other = [EMAIL PROTECTED] otherInfo =
[EMAIL PROTECTED]
DEBUG (init): node = 5 info = [EMAIL PROTECTED] DEBUG (init): node = 4 info = [EMAIL PROTECTED] DEBUG (init): node = 3 info = [EMAIL PROTECTED] DEBUG (init): node = 2 info = [EMAIL PROTECTED] DEBUG (init): node = 1 info = [EMAIL PROTECTED]
DEBUG (after init): node = 5 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 4 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 3 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 2 info =
[EMAIL PROTECTED]
DEBUG (after init): node = 1 info =
[EMAIL PROTECTED]
DEBUG (visit): node = 5
DEBUG (visit): other = null otherInfo = null
Tests run: 4, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.016 sec
<<< 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.<init>(
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.executeTestSet(
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.<init>(
DepthFirstAnalysis.java:83)
at org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.setUpGraph2(
TestDepthFirstAnalysis.java:78)
       at
org.apache.openjpa.lib.graph.TestDepthFirstAnalysis.testForwardEdges(
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.executeTestSet(
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
>>> 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();

Reply via email to