exception - Why do I get JSF (primefaces) Unable to create new Collection instance for type java.util.Arrays$ArrayList -
this question has answer here:
maybe can me this: i've got datatable , it's populated arraylist<> , when try update datatable after causing changes in i've got exception
severe [http-apr-8080-exec-1] com.sun.faces.renderkit.html_basic.menurenderer.createcollection unable create new collection instance type java.util.arrays$arraylist java.lang.instantiationexception: java.util.arrays$arraylist
caused by: java.lang.nosuchmethodexception: java.util.arrays$arraylist.()
i saw similar questions on sof but, unfortunatly, it's no use me. (my arraylist doesn't instantiated arrays.aslist). app works fine, need remove exception.
this part of .xhtml datatable define:
<p:datatable id="columnsdef" widgetvar="columnslist" value="#{setup.columnwrapperlist}" var="columnvar" rowkey="#{columnvar.wrappedcolumnid}" selectionmode="single" selection="#{setup.selectedcolumn}" lazy="false" rows="10" paginator="false" style="width: 100%" emptymessage="#{msg['common.emptymsg']}" resizablecolumns="true" filterevent="enter" tablestyle="width: auto">
here part of .xhtml whre setup.columnwrapperlist updated
<div class="left"> <p:commandbutton icon="ui-icon-triangle-1-n" actionlistener="#{setup.decorder}" update="@([id$=columnsdef])" /> <p:commandbutton icon="ui-icon-triangle-1-s" actionlistener="#{setup.incorder}" update="@([id$=columnsdef])" /> </div>
and finaly part of "setup" bean cause changes in arraylist:
public void decorder() { int = selectedcolumn.getorder(); if (i > 0) { columnwrapperlist.get(i).setorder(i - 1); columnwrapperlist.get(i - 1).setorder(i); columnwrapperlist.sort(new comparator<columnwrapper>() { @override public int compare(columnwrapper o1, columnwrapper o2) { return o1.getorder() < o2.getorder() ? -1 : 1; } }); } }
can 1 me please?
it works without sort? if so, try sort collections.sort:
collections.sort(columnwrapperlist, new comparator<columnwrapper>() { @override public int compare(columnwrapper o1, columnwrapper o2) { return integer.compare(o1.getorder(), o2.getorder()); } });
Comments
Post a Comment