Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-123

Generated controller finder method loses case on length() check for mixed case string fields

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0.M2
    • Fix Version/s: 1.0.0.RC1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Mac OS X Leopard, Java 1.6

      Description

      If I generate a domain class that has a camel-cased name such as courseName, and then generate a dynamic finder based on the name, the length check within the Controller's find/findByFieldNameLike method incorrectly generates an all lower-case field name within the length check, although it is correct in the null check:

      @org.springframework.web.bind.annotation.RequestMapping(value = "find/ByCourseNameLike", method = org.springframework.web.bind.annotation.RequestMethod.GET)
      public java.lang.String CourseController.findCoursesByCourseNameLike(@org.springframework.web.bind.annotation.RequestParam("coursename") java.lang.String courseName, org.springframework.ui.ModelMap modelMap)

      { if(courseName == null || coursename.length() == 0) throw new IllegalArgumentException("A courseName is required."); modelMap.addAttribute("courses", com.chariot.roo.demo.domain.Course.findCoursesByCourseNameLike(courseName).getResultList()); return "course/list"; }

      Roo commands:

      create project -topLevelPackage roodemo
      install jpa -provider HIBERNATE -database HYPERSONIC_IN_MEMORY
      new persistent class jpa -name ~.Course
      add field string -fieldName courseName
      list finders for -class roodemo.Course
      install finder -finderName findCoursesByCourseNameLike
      new controller automatic -name roodemo.CourseController -formBackingObject roodemo.Course

      Execute a mvn jetty:run to see the compiler error (or just mvn compile). I get:

      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Compiler errors :
      error at if(courseName == null || coursename.length() == 0) throw new IllegalArgumentException("A courseName is required.");

      Note the coursename.length() is the error.

        Attachments

          Activity

            People

            Assignee:
            sschmidt Stefan Schmidt
            Reporter:
            krimple Ken Rimple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: