on 12-14-2006 11:01 AM
Hi .
I use the sortElements
Code :
<b>DefaultUnitsComparator comp;
comp = new DefaultUnitsComparator("ID");
wdContext.nodeUnitsDets().sortElements(comp);</b>
The compare method i implemented OK .
But....
I get an exception "java.lang.ArrayIndexOutOfBoundsException: 7 "
Why?( the Node is in size 7 )
Thanks
Hi, you've got a problem with your class DefaultUnitsComparator, could you paste the code here so i can help you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
<b>The code :</b>
<b>public</b> class DefaultUnitsComparator implements Comparator
{
String attribute;
<b>public</b> DefaultUnitsComparator(String attrib)
{
this.attribute = attrib;
}
<b>public</b> int compare(Object o1, Object o2)
{
try{
IWDNodeElement units1 = (IWDNodeElement) o1;
IWDNodeElement units2 = (IWDNodeElement) o2;
return units1.getAttributeAsText(attribute).
compareTo(units2.getAttributeAsText(attribute));
}
catch (Exception e)
{}
//arbitrary order
return 1;
}
Thanks,Faniel
Hi faniel,
If the array is in size 7, shouldn't the index be between 0 and 6 ? If so, index 7 will be out of bounds.
Nuno Santos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
It implemented like the example...
The error happens on the sortelemnts....
java.lang.ArrayIndexOutOfBoundsException: 7
at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.reorder(Node.java:2204)
at com.sap.tc.webdynpro.progmodel.context.Node.onListChange(Node.java:1521)
at com.sap.tc.webdynpro.progmodel.context.Node.access$1100(Node.java:85)
at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.fireListEvent(Node.java:1920)
at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.reorder(Node.java:2207)
at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.rearrange(Node.java:2096)
at com.sap.tc.webdynpro.progmodel.context.Node$MappedElementList.rearrange(Node.java:2406)
at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.sortElements(Node.java:2092)
<b>at com.sap.tc.webdynpro.progmodel.context.Node.sortElements</b>(Node.java:719)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this https://forums.sdn.sap.com/click.jspa?searchID=411422&messageID=246334
Where you are getting the exception ??
Regards,Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.