« Return to Thread: GRAILS-1320

Re: GRAILS-1320

by Jesse O'Neill-Oine-2 :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
I just can't seem to crack this one.  GRAILS-1320 is definitely a problem for me, but I cannot determine if it's truly a Grails problem or just something I'm doing wrong.  I also cannot get a simple example to reproduce the problem, so that probably points at the fault being mine. :)

This is the error that I consistently see if I don't use the workaround:

Error executing tests IllegalArgumentException occurred while calling setter of Foo.bars; nested exception is org.hibernate.PropertyAccessException : IllegalArgumentException occurred while calling setter of Foo.bars ...
org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred while calling setter of Foo.bars; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of Foo.bars
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of Foo.bars
... lots of stack output ...
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@612edb

In this case, it's from a integration test, but it also occurs during normal running.  The last line with the class cast exception is inconsistent; sometimes it is: Caused by: java.lang.IllegalArgumentException: argument type mismatch.

Anyone have a guess as to what I could be doing that would cause behavior like this?

-Jesse

On 10/10/07, Jesse O'Neill-Oine <jesse@...> wrote:
Yes, they do.  However, in trying to create a simple test case to show the problem, I'm seeing things work as expected.  I'm going to dig into it a little more and see if I can come up with a test case that shows the issue.

-Jesse


On 10/9/07, Jeff Brown <brownj@...> wrote:
Jesse,

Do your Bar objects (or Document objects per the JIRA) implement Comparable?



jb


On 10/9/07, Jesse O'Neill-Oine <jesse@...> wrote:
GRAILS-1320 is driving me crazy lately.  I use SortedSet quite a bit in my app and I hate having to do the workaround for every one I use.  Right now the bug isn't on the list for 1.0; is there any chance this can be fixed for 1.0?  I'm kinda surprised that more people aren't complaining about this problem, which leads me to ask: am I just doing this wrong (i.e. is there a better way to deal with this problem)?

Should be:
class Foo {
  SortedSet bars
  static hasMany = [bars:Bar]
}

Instead I have to do:
class Foo {
  SortedSet bars = new TreeSet()
  static hasMany = [bars:Bar]

  public void setBars(Collection c) {
    if (c instanceof SortedSet) {
      bars = c
    } else {
      bars = new TreeSet(c)
    }
  }
}

--
----------------------------------------------------------
Jesse O'Neill-Oine // jesse@...
Refactr LLC // http://refactr.com
mobile // 612-670-5037
----------------------------------------------------------



--
Jeff Brown
Principal Software Engineer
Object Computing Inc.
http://www.ociweb.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/



--
----------------------------------------------------------
Jesse O'Neill-Oine // jesse@...
Refactr LLC // http://refactr.com
mobile // 612-670-5037
----------------------------------------------------------



--
----------------------------------------------------------
Jesse O'Neill-Oine // jesse@...
Refactr LLC // http://refactr.com
mobile // 612-670-5037
----------------------------------------------------------

 « Return to Thread: GRAILS-1320