Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to resolve cannot be cast to java.util.ArrayList

2780557May 18 2015 — edited May 18 2015

I hava a panel accordion with this function in disclosureListener:

    public void allLogs(DisclosureEvent disclosureEvent) {

        System.out.println("SHOW ALL LOGS ");

        int stateIndex[];

        DCIteratorBinding dcLogs = (DCIteratorBinding)getBindings().get("LogTypesVO1Iterator");

        ViewObject voLogs = dcLogs.getViewObject();

        JUCtrlListBinding list = (JUCtrlListBinding)getBindings().get("LogTypesVO1");

        System.out.println("LIST LOGS " + list);

        DCIteratorBinding iter = list.getDCIteratorBinding();

        System.out.println("ITER LOGS " + iter);

        RowSetIterator rsi = voLogs.createRowSetIterator(null);

        System.out.println("RSI " + rsi);

        int i = 0;

        int rowCount = (int)voLogs.getEstimatedRowCount();

        stateIndex = new int[rowCount];

        while (rsi.hasNext()) {

            System.out.println("SEGUINTE! ");

            Row nextRow = rsi.next();

            iter.setCurrentRowWithKey(nextRow.getKey().toStringFormat(true));

            int indx = iter.getCurrentRowIndexInRange();

            stateIndex[i] = indx;

            System.out.println("Index in loop--" + indx);

            i++;

        }

        rsi.closeRowSetIterator();

        System.out.println("STATE INDICE " + stateIndex);

        list.setSelectedIndices(stateIndex);

        System.out.println("LISTA " + list);

    }

After, i have in valuechangelister of selectmanycheckbox this function:

    public void filterLogs(ValueChangeEvent valueChangeEvent) {

        DCIteratorBinding dc2 = (DCIteratorBinding)evaluteEL("#{bindings.EntityLogsVO1Iterator}");

        ViewObject vo2 = dc2.getViewObject();

        String WhereClause = "LOG_TYPE in(";

        System.out.println("VALOR " + valueChangeEvent.getNewValue());

        if (valueChangeEvent.getNewValue() != null) {

            java.util.ArrayList selectedValues = (java.util.ArrayList)valueChangeEvent.getNewValue();

            for (int i = 0; i < selectedValues.size(); i++) {

                if (!WhereClause.equals("LOG_TYPE in("))

                    WhereClause += ",";

                WhereClause += "'" + selectedValues.get(i) + "'";

            }

            WhereClause += ")";

            vo2.setWhereClause(WhereClause);

            vo2.executeQuery();

        } else {

            WhereClause = "1=2";

            vo2.setWhereClause(WhereClause);

            vo2.executeQuery();

        }

    }

But when i uncheck a item of selectmanychoice, sow this error:

valueChangeListener="#{backingBeanScope.backing_OrderDetail.filterLogs}": java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.ArrayList.

My selectmanycheckbox have this propertys:

<af:selectManyCheckbox value="#{bindings.LogTypesVO1.inputValue}"

                                               label="#{bindings.LogTypesVO1.label}" id="smc1"

                                               binding="#{backingBeanScope.backing_OrderDetail.smc1}" simple="true"

                                               layout="horizontal" autoSubmit="true"

                                               valueChangeListener="#{backingBeanScope.backing_OrderDetail.filterLogs}">

                            <f:selectItems value="#{bindings.LogTypesVO1.items}" id="si2"

                                           binding="#{backingBeanScope.backing_OrderDetail.si2}"/>

                        </af:selectManyCheckbox>

my jdev version is 11.2.4.0

This post has been answered by Ashish Awasthi on May 18 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 15 2015
Added on May 18 2015
7 comments
1,927 views