Menu

#141 cant use negative index in OrderedKAryTree.addEdge() anymore

open
nobody
5
2010-02-16
2010-02-16
No

if (index < 0 || index >= order)
throw new IllegalArgumentException("'index' must be in [0, [order-1]]");

Discussion

  • Peter Adolphs

    Peter Adolphs - 2010-02-16

    Sorry, I accidently hit ENTER, which means publish bug report for Sourceforge...

    The JavaDocs of OrderedKAryTree.addEdge(E e, V parent, V child, int index) says that a child is placed at the lowest available position if an index less than 0 is given. This is not the case. Instead an IllegalArgumentException is thrown (see the relevant code fragment in the details above). This means that addEdge(E e, V parent, V child) will always throw an exception.

     
  • Peter Adolphs

    Peter Adolphs - 2010-02-16
    • summary: cant use negative index in OrderedKAryTree.addEdge() anymo --> cant use negative index in OrderedKAryTree.addEdge() anymore
     
  • Peter Adolphs

    Peter Adolphs - 2010-02-16

    I think this error was introduced with the fix of 2799634. However, the fix is not complete. Even if a non-negative index is specified, there is a IndexOutOfBoundsException raised at OrderedKAryTree.java:236 by the check outedges.get(index) != null. I think one should also check whether the specified index < outedges.size() before.

     

Log in to post a comment.

MongoDB Logo MongoDB