Skip to content

[develop_2.0] String index out of exception in android-java template #369

Closed

Description

@cantecim

Hi,
Im using develop_2.0 branch

I succesfully compiled for java when i try with android-java it gives me : java.lang.StringIndexOutOfBoundsException

cmd(MINGW32);
java -cp /d/swagger-codegen/target/:/d/swagger-codegen/target/lib/ com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l android -o /d/swagger-codegen/samples/client/petstore/android-java -t /d/swagger-codegen/target/classes/android-java/

reading from http://petstore.swagger.wordnik.com/v2/swagger.json
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at java.lang.String.charAt(String.java:658)
    at java.util.regex.Matcher.appendReplacement(Matcher.java:762)
    at java.util.regex.Matcher.replaceAll(Matcher.java:906)
    at java.lang.String.replaceAll(String.java:2162)
    at com.wordnik.swagger.codegen.languages.AndroidClientCodegen.modelFileFolder(AndroidClientCodegen.java:74)
    at com.wordnik.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:87)
    at com.wordnik.swagger.codegen.Codegen.main(Codegen.java:84)

Activity

  1. changed the title [-]String index out of exception in android-java template[/-] [+][develop_2.0] String index out of exception in android-java template[/+] on Jan 9, 2015
  2. fehguy commented on Jan 9, 2015

    @fehguy
    Contributor

    Can you please take the default output folder (remove the -o flag) and report back what you get?

  3. cantecim commented on Jan 10, 2015

    @cantecim
    ContributorAuthor

    Sure. I tried it when i was in work. So I'll report back the output monday(two days later)

  4. cantecim commented on Jan 10, 2015

    @cantecim
    ContributorAuthor

    Actually, I am trying on home now

    Using java 1.8 and mvn 3.1.1

    One more time i can compile for java. When i try it for android using below commands

    java -cp "target/*;target/lib/*" com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l android -t target/classes/android-java -o samples/client/petstore/android-java
    
    java -cp "target/*;target/lib/*" com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l android -t target/classes/android-java
    

    Note: Without the -t parameter it can't find the mustache files only for android

    The output is same for all commands

    reading from http://petstore.swagger.wordnik.com/v2/swagger.json
    java.lang.IllegalArgumentException: character to be escaped is missing
        at java.util.regex.Matcher.appendReplacement(Matcher.java:809)
        at java.util.regex.Matcher.replaceAll(Matcher.java:955)
        at java.lang.String.replaceAll(String.java:2210)
        at com.wordnik.swagger.codegen.languages.AndroidClientCodegen.modelFileFolder(AndroidClientCodegen.java:74)
        at com.wordnik.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:87)
        at com.wordnik.swagger.codegen.Codegen.main(Codegen.java:84)
    
  5. added a commit that references this issue on Jan 10, 2015
    f6055dd
  6. added a commit that references this issue on Jan 10, 2015
    fd39402
  7. cantecim commented on Jan 10, 2015

    @cantecim
    ContributorAuthor

    So I correctly changed the AndroidClientCodegen.java the issue on my home environment solved

    I'll try on work once I back to work and report back you for that issue

  8. fehguy commented on Jan 10, 2015

    @fehguy
    Contributor

    Thanks a lot--I've merged that PR.

  9. cantecim commented on Jan 12, 2015

    @cantecim
    ContributorAuthor

    Compiled succesfully. It seems it had fixed whole issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions