Results 1 to 6 of 6

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

  1. #1
    Join Date
    Oct 2009
    Posts
    6

    Unhappy '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. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

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

    Thanks!

    -Stefan

  3. #3
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  4. #4
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

  5. #5
    Join Date
    Oct 2009
    Posts
    6

    Default

    thanks for responding. hope you'll fix it.

  6. #6
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •