3 Replies Latest reply on Dec 2, 2006 9:01 PM by Ben Wang

    Working with TreeSet / checkSetRecursion bug? [v2.0 alpha]

    Itamar Rogel Newbie

      This regards a bug (?) in v2.0 alpha that'll affect only the case of storing a sorted set (e.g. TreeSet) in PojoCache. Now, the documentation specifies that "The Set interface maps to java.util.HashSet implementation", but does that mean the user should never store i.e. TreeSets (e.g., as a data member) in the PojoCache ?

      If not, this probably is a bug:

      CollectionClassHandler.checkSetRecursion() does a remove() to the Set with itslef. However, since a SortedSet looks for a member using comparisons and will cast the given key (for removal) to Comparable. and a SortedSet does not implement Comparable, a ClassCastException will occur and escape the Cache code.

      Using a custom "ComparableSortedSet" which inherits from SortedSet and adds an implementation for Comaprable, everything seems to work.

      I think this can be pretty easily handled in the PojoCache code. Do you agree? Should I file a bug?