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

DataOnDemand code invalid when @Min and @Max annotations are used on an entity field

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.0.M3
    • Fix Version/s: 1.1.0.RC1
    • Component/s: TESTING
    • Labels:
      None
    • Environment:
      Windows XP, Sun JDK 1.6.0_20

      Description

      When specifying a @Min(?L) and @Max(?L) annotation on an entity field the DataOnDemand aspect that gets generated for that entity contains a compilation error. Code that gets generated for

      MyBean.java
      ...
      @Min(0L)
      @Max(100L)
      private long total;
      ...
      

      is

      MyBeanDataOnDemand_Roo_DataOnDemand.aj
      ...
      public MyBean MyBeanDataOnDemand.getNewTransientMyBean(int index) {
         ...
         java.lang.Long total = new Integer(index).longValue();
         if (total < 0L || total > L100) { // Should be 100L instead of L100
             total = 100L;
         }
      ...
      }
      

      Note the greater than condition is invalid.

      This only seems to happen when both a @Min and @Max annotations are present together. Having either on it's own works fine.

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            scra039 Steven Crawford
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: