You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2008/01/21 06:09:23 UTC

[jira] Resolved: (CAMEL-270) Error in org.apache.camel.util.ObjectHelper

     [ https://issues.apache.org/activemq/browse/CAMEL-270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-270.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.0

> Error in org.apache.camel.util.ObjectHelper
> -------------------------------------------
>
>                 Key: CAMEL-270
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-270
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>            Reporter: Axel Hohaus
>             Fix For: 1.3.0
>
>
> Found an error in method contains of class org.apache.camel.util.ObjectHelper.
> If using an array instead of a collection.
> Following line is wrong:
> Iterator iter = ObjectConverter.iterator(value);
> It should be iterated over collectionOrArray variable.
> Correct line is:
> Iterator iter = ObjectConverter.iterator(collectionOrArray);
> Complete new method is:
> public static boolean contains(Object collectionOrArray, Object value) {
>     if (collectionOrArray instanceof Collection) {
>         Collection collection = (Collection)collectionOrArray;
>         return collection.contains(value);
>     } else {
>         Iterator iter = ObjectConverter.iterator(value);
>         while (iter.hasNext()) {
>             if (equal(value, iter.next())) {
>                 return true;
>             }
>         }
>         return false;
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.