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

DataOnDemandMetadata assumes @Column annotation length attribute to be greater the one for an Entity attribute

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 1.1.2.RELEASE
    • Fix Version/s: 1.1.3.RELEASE
    • Component/s: TESTING
    • Labels:
      None

      Description

      The following code below (lines 656-665) in DataOnDemandMetadata.java assumes an entity's @Column annotation's "length" attribute WILL NOT be of size one for a particular column. This would cause a StringIndexOutOfBoundsException when the code below runs if the entity's @Column annotation's "length" attribute is of size one. When the Roo shell is spawned it will print the console the following info "String index out of range: -1".

      else {
      // Check for @Column
      AnnotationMetadata columnAnnotation = MemberFindingUtils.getAnnotationOfType(field.getAnnotations(), COLUMN);
      if (columnAnnotation != null) {
      AnnotationAttributeValue<?> lengthValue = columnAnnotation.getAttribute(new JavaSymbolName("length"));
      if (lengthValue != null && (initializer.length() + 2) > (Integer) lengthValue.getValue())

      { initializer = initializer.substring(0, (Integer) lengthValue.getValue() - 2); }

      }
      }

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            bdinka Bisrat Dinka
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: