Announcement Announcement Module
Collapse
No announcement yet.
'String index out of range: -1' error when creating a new entity Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 'String index out of range: -1' error when creating a new entity

    Hi. Does anybody know how to create entities with BO in the end?
    I want to create a new entity FactBO. When I type 'entity --name ~.model.FactBO' I get the following message from Roo:

    Created SRC_MAIN_JAVA ... FactBO.java
    Undo create SRC_MAIN_JAVA ... FactBO.java
    String index out of range: -1.

    When I try to create FactBo with a small 'o' in the end everything works fine. It also works if I type 'entity --name ~.model.SomethingBO'. It seems there's a bug somewhere and Roo cannot create some entities with BO in the end.

  • #2
    Hmm that is certainly weird behaviour. Can you please open a Jira ticket for this so we can take a closer look?

    Thanks!

    -Stefan

    Comment


    • #3
      Appears to be due to an Inflector bug:

      Code:
      roo> entity --name ~.foo.BarBO
      Created SRC_MAIN_JAVA/com/foo/foo
      Created SRC_MAIN_JAVA/com/foo/foo/BarBO.java
      Undo create SRC_MAIN_JAVA/com/foo/foo/BarBO.java
      Undo create SRC_MAIN_JAVA/com/foo/foo
      String index out of range: -1
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
          at java.lang.String.substring(String.java:1937)
          at org.jvnet.inflector.rule.SuffixInflectionRule.apply(SuffixInflectionRule.java:57)
          at org.jvnet.inflector.RuleBasedPluralizer.pluralizeInternal(RuleBasedPluralizer.java:169)
          at org.jvnet.inflector.RuleBasedPluralizer.pluralize(RuleBasedPluralizer.java:147)
          at org.jvnet.inflector.RuleBasedPluralizer.pluralize(RuleBasedPluralizer.java:121)
          at org.jvnet.inflector.Noun.pluralOf(Noun.java:121)
          at org.jvnet.inflector.Noun.pluralOf(Noun.java:89)
          at org.springframework.roo.addon.plural.PluralMetadata.<init>(PluralMetadata.java:59)
          at org.springframework.roo.addon.plural.PluralMetadataProvider.getMetadata(PluralMetadataProvider.java:30)
      We should catch this bug and try again with a lowercase conversion.

      Comment


      • #4
        https://jira.springsource.org/browse/ROO-305

        Comment


        • #5
          thanks for responding. hope you'll fix it.

          Comment


          • #6
            ROO-305 is now resolved. This will be present in Roo 1.0.0.RC3 or above. You can also test it in the meantime by using SVN revision 353 or above.

            Comment

            Working...
            X