You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What do you see instead?
Program aborts with StringIndexOutOfBoundsException (full stack trace below).
What version of the product are you using?
0.3.0
On what Java version?
java version "1.6.0_30"
Replacing this code (EnumRule.getConstantName(EnumRule.java:188)):
if (Character.isDigit(enumName.charAt(0))) {
enumName = "" + enumName;
}
with this code:
if( enumName.length() == 0 ){
enumName = "EMPTY";
}else if (Character.isDigit(enumName.charAt(0))) {
enumName = "" + enumName;
}
resolves the issue.
Stack Trace:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at com.googlecode.jsonschema2pojo.rules.EnumRule.getConstantName(EnumRule.java:188)
at com.googlecode.jsonschema2pojo.rules.EnumRule.addEnumConstants(EnumRule.java:162)
at com.googlecode.jsonschema2pojo.rules.EnumRule.apply(EnumRule.java:99)
at com.googlecode.jsonschema2pojo.rules.EnumRule.apply(EnumRule.java:1)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:71)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:1)
at com.googlecode.jsonschema2pojo.rules.PropertyRule.apply(PropertyRule.java:77)
at com.googlecode.jsonschema2pojo.rules.PropertyRule.apply(PropertyRule.java:1)
at com.googlecode.jsonschema2pojo.rules.PropertiesRule.apply(PropertiesRule.java:62)
at com.googlecode.jsonschema2pojo.rules.PropertiesRule.apply(PropertiesRule.java:1)
at com.googlecode.jsonschema2pojo.rules.ObjectRule.apply(ObjectRule.java:108)
at com.googlecode.jsonschema2pojo.rules.ObjectRule.apply(ObjectRule.java:1)
at com.googlecode.jsonschema2pojo.rules.TypeRule.apply(TypeRule.java:95)
at com.googlecode.jsonschema2pojo.rules.TypeRule.apply(TypeRule.java:1)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:73)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:66)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:1)
at com.googlecode.jsonschema2pojo.SchemaMapperImpl.generate(SchemaMapperImpl.java:65)
at com.googlecode.jsonschema2pojo.cli.Jsonschema2Pojo.generate(Jsonschema2Pojo.java:92)
at com.googlecode.jsonschema2pojo.cli.Jsonschema2Pojo.main(Jsonschema2Pojo.java:60)
Original author: jemac...@gmail.com (July 06, 2012 17:09:51)
What steps will reproduce the problem?
{
"id": "test",
"type": "object",
"additionalProperties": false,
"properties": {
"gender": {
"type": "string",
"default": "",
"enum": [ "", "male", "female" ]
}
}
}
What is the expected output?
Test.java
What do you see instead?
Program aborts with StringIndexOutOfBoundsException (full stack trace below).
What version of the product are you using?
0.3.0
On what Java version?
java version "1.6.0_30"
Replacing this code (EnumRule.getConstantName(EnumRule.java:188)):
if (Character.isDigit(enumName.charAt(0))) {
enumName = "" + enumName;
}
with this code:
if( enumName.length() == 0 ){
enumName = "EMPTY";
}else if (Character.isDigit(enumName.charAt(0))) {
enumName = "" + enumName;
}
resolves the issue.
Stack Trace:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at com.googlecode.jsonschema2pojo.rules.EnumRule.getConstantName(EnumRule.java:188)
at com.googlecode.jsonschema2pojo.rules.EnumRule.addEnumConstants(EnumRule.java:162)
at com.googlecode.jsonschema2pojo.rules.EnumRule.apply(EnumRule.java:99)
at com.googlecode.jsonschema2pojo.rules.EnumRule.apply(EnumRule.java:1)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:71)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:1)
at com.googlecode.jsonschema2pojo.rules.PropertyRule.apply(PropertyRule.java:77)
at com.googlecode.jsonschema2pojo.rules.PropertyRule.apply(PropertyRule.java:1)
at com.googlecode.jsonschema2pojo.rules.PropertiesRule.apply(PropertiesRule.java:62)
at com.googlecode.jsonschema2pojo.rules.PropertiesRule.apply(PropertiesRule.java:1)
at com.googlecode.jsonschema2pojo.rules.ObjectRule.apply(ObjectRule.java:108)
at com.googlecode.jsonschema2pojo.rules.ObjectRule.apply(ObjectRule.java:1)
at com.googlecode.jsonschema2pojo.rules.TypeRule.apply(TypeRule.java:95)
at com.googlecode.jsonschema2pojo.rules.TypeRule.apply(TypeRule.java:1)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:73)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:66)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:1)
at com.googlecode.jsonschema2pojo.SchemaMapperImpl.generate(SchemaMapperImpl.java:65)
at com.googlecode.jsonschema2pojo.cli.Jsonschema2Pojo.generate(Jsonschema2Pojo.java:92)
at com.googlecode.jsonschema2pojo.cli.Jsonschema2Pojo.main(Jsonschema2Pojo.java:60)
Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=58
The text was updated successfully, but these errors were encountered: