Announcement Announcement Module
No announcement yet.
'String index out of range: -1' error when creating a new entity Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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 ...
    Undo create SRC_MAIN_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?




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

      roo> entity --name
      Created SRC_MAIN_JAVA/com/foo/foo
      Created SRC_MAIN_JAVA/com/foo/foo/
      Undo create SRC_MAIN_JAVA/com/foo/foo/
      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(
          at org.jvnet.inflector.rule.SuffixInflectionRule.apply(
          at org.jvnet.inflector.RuleBasedPluralizer.pluralizeInternal(
          at org.jvnet.inflector.RuleBasedPluralizer.pluralize(
          at org.jvnet.inflector.RuleBasedPluralizer.pluralize(
          at org.jvnet.inflector.Noun.pluralOf(
          at org.jvnet.inflector.Noun.pluralOf(
          at org.springframework.roo.addon.plural.PluralMetadata.<init>(
          at org.springframework.roo.addon.plural.PluralMetadataProvider.getMetadata(
      We should catch this bug and try again with a lowercase conversion.


      • #4


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


          • #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.