shadybones / hypergraphdb

Automatically exported from code.google.com/p/hypergraphdb
0 stars 0 forks source link

Remove of an atom with an incident HGLink and ByTargetIndexer present may cause exception #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
graph.remove(atom, true) leads to an exception, if 
A) a link exists that points to the atom
AND B) a ByTargetIndexer for the Link type exists who's key is the atom.

What steps will reproduce the problem?
1. Create An HGLink l1 and let it point to 2 atoms a1, a2.
2. Create A ByTargetIndexer on target 1 and register it.
3. Remove a2, keeping incident links
Or Run the following:
        HyperGraph graph = HGEnvironment.get("C:\\temp\\testHG");
        HGHandle a1 = graph.add("A1");
        HGHandle a2 = graph.add("A2");
        HGHandle l1 = graph.add(new HGPlainLink(a1, a2));
        ByTargetIndexer idx1 = new ByTargetIndexer( graph.getType(l1), 1);
        graph.getIndexManager().register(idx1);
        //Exception here:
        graph.remove(a2, true);

Leads to:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
    at org.hypergraphdb.HGPlainLink.getTargetAt(HGPlainLink.java:69)
    at org.hypergraphdb.indexing.ByTargetIndexer.getKey(ByTargetIndexer.java:64)
    at org.hypergraphdb.indexing.HGKeyIndexer.unindex(HGKeyIndexer.java:61)
    at org.hypergraphdb.HGIndexManager.maybeUnindex(HGIndexManager.java:445)
    at org.hypergraphdb.HyperGraph.replaceTransaction(HyperGraph.java:2031)
    at org.hypergraphdb.HyperGraph.targetRemoved(HyperGraph.java:1873)
    at org.hypergraphdb.HyperGraph.removeTransaction(HyperGraph.java:1079)

Original issue reported on code.google.com by thomas.h...@gmail.com on 11 Jan 2012 at 9:14

GoogleCodeExporter commented 9 years ago
Issue title should read: "Remove of an atom with an incident HGLink and  
ByTargetIndexer present may cause exception"

Original comment by thomas.h...@gmail.com on 11 Jan 2012 at 9:30