Grails
  1. Grails
  2. GRAILS-6463

Adding a method containing an 'int' parameter within a domain class throws exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.3.3
    • Component/s: Commons, Persistence
    • Labels:
      None
    • Environment:
      Windows Vista, Grails 1.3.1
    • Testcase included:
      yes

      Description

      It took me a very long time to narrow down to this bug because stacktrace contains useless logs.

      Very easy to reproduce.
      1- Create a project
      2- Create a domain class
      3- Add method :
      def getName(int i)

      { return "uehfi" }

      4- grails run-app => BOUM when starting the application

      If you replace the method by def getName(Integer i), then it works ??!!!

      Project attached.

      1. stacktrace.log
        141 kB
        Fabien Benichou

        Activity

        Hide
        Graeme Rocher added a comment -

        I followed your steps and tried the attached application and cannot reproduce this problem

        Show
        Graeme Rocher added a comment - I followed your steps and tried the attached application and cannot reproduce this problem
        Hide
        Fabien Benichou added a comment -

        Did you run the project on Windows?? I tried on 2 different machines (Windows Vista and Windows 7) and I always get a NPE at startup with:

        ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
        at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:164)
        at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:159)
        ...
        Caused by: java.lang.NullPointerException
        at java.lang.Class.isAssignableFrom(Native Method)
        ... 23 more

        Show
        Fabien Benichou added a comment - Did you run the project on Windows?? I tried on 2 different machines (Windows Vista and Windows 7) and I always get a NPE at startup with: ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml] : Invocation of init method failed; nested exception is java.lang.NullPointerException at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:164) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:159) ... Caused by: java.lang.NullPointerException at java.lang.Class.isAssignableFrom(Native Method) ... 23 more
        Hide
        Fabien Benichou added a comment -

        Please see my comments. I have given the attached project to another person that has also experienced the startup failure

        Show
        Fabien Benichou added a comment - Please see my comments. I have given the attached project to another person that has also experienced the startup failure
        Hide
        Graeme Rocher added a comment -

        No I tried it on Mac OS X.

        Reducing priority since it only effects a small subset of environments. It would help if you attached your stacktrace.log file.

        Show
        Graeme Rocher added a comment - No I tried it on Mac OS X. Reducing priority since it only effects a small subset of environments. It would help if you attached your stacktrace.log file.
        Hide
        Fabien Benichou added a comment -

        Stacktrace.log attached

        Show
        Fabien Benichou added a comment - Stacktrace.log attached
        Hide
        Graeme Rocher added a comment -

        I have no idea how this exception could possibly occur because the getType() method cannot return null, anyway I've added a null check which should fix the problem, however I cannot reproduce (not even on a local Windows VM) so cannot be sure:

        http://github.com/grails/grails-core/commit/85f71a3aff30fe55adb25eed9781cd86f60bea48

        Show
        Graeme Rocher added a comment - I have no idea how this exception could possibly occur because the getType() method cannot return null, anyway I've added a null check which should fix the problem, however I cannot reproduce (not even on a local Windows VM) so cannot be sure: http://github.com/grails/grails-core/commit/85f71a3aff30fe55adb25eed9781cd86f60bea48
        Hide
        Fabien Benichou added a comment -

        Very strange that you cannot reproduce it. If currentProp.getType() returns null, I believe that other issues will be raised. I will test 1.3.3 and post my results on this Jira issue.

        Show
        Fabien Benichou added a comment - Very strange that you cannot reproduce it. If currentProp.getType() returns null, I believe that other issues will be raised. I will test 1.3.3 and post my results on this Jira issue.
        Hide
        Burt Beckwith added a comment -

        Duplicate of GRAILS-5999 fixed in 1.3.2

        Show
        Burt Beckwith added a comment - Duplicate of GRAILS-5999 fixed in 1.3.2

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Fabien Benichou
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development