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/main/java/org/apache/openjpa/lib/graph/DepthFirstAnalysis.java
===================================================================
--- openjpa-lib/src/main/java/org/apache/openjpa/lib/graph/DepthFirstAnalysis.java	(revision 557093)
+++ openjpa-lib/src/main/java/org/apache/openjpa/lib/graph/DepthFirstAnalysis.java	(working copy)
@@ -59,17 +59,26 @@
     public DepthFirstAnalysis(Graph graph) {
         _graph = graph;
 
+        NodeInfo info;
+        Object node;
         // initialize node infos
         Collection nodes = graph.getNodes();
-        for (Iterator itr = nodes.iterator(); itr.hasNext();)
-            _nodeInfo.put(itr.next(), new NodeInfo());
+        for (Iterator itr = nodes.iterator(); itr.hasNext();) {
+            node = itr.next();
+            info = new NodeInfo();
+            System.out.println("DEBUG (init): node = " + node + " info = " + info);
+            _nodeInfo.put(node, info);
+        }
 
         // visit all nodes -- see intro to algo's book
-        NodeInfo info;
-        Object node;
         for (Iterator itr = nodes.iterator(); itr.hasNext();) {
             node = itr.next();
             info = (NodeInfo) _nodeInfo.get(node);
+            System.out.println("DEBUG (after init): node = " + node + " info = " + info);
+        }
+        for (Iterator itr = nodes.iterator(); itr.hasNext();) {
+            node = itr.next();
+            info = (NodeInfo) _nodeInfo.get(node);
             if (info.color == NodeInfo.COLOR_WHITE)
                 visit(graph, node, info, 0, new LinkedList());
         }
@@ -90,10 +99,12 @@
         NodeInfo otherInfo;
         int maxChildTime = time - 1;
         int childTime;
+        System.out.println("DEBUG (visit): node = " + node);
         for (Iterator itr = edges.iterator(); itr.hasNext();) {
             edge = (Edge) itr.next();
             other = edge.getOther(node);
             otherInfo = (NodeInfo) _nodeInfo.get(other);
+            System.out.println("DEBUG (visit): other = " + other + " otherInfo = " + otherInfo);
             if (otherInfo.color == NodeInfo.COLOR_WHITE) {
                 // undiscovered node; recurse into it
                 path.add(edge);

Reply via email to