java.lang.StringIndexOutOfBoundsException: String index out of range: 0

Coderanch | Sreesanth Nair | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Hibernate Transform Failiing... :(

    Coderanch | 4 years ago | Sreesanth Nair
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  2. 0

    Hibernate, Null values and nativeSQL

    Stack Overflow | 7 years ago | gotch4
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  3. 0

    [HHH-2304] Wrong type detection for sql type char(x) columns - Hibernate JIRA

    atlassian.net | 1 year ago
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Using createSQLQuery with query like this "select column1, column2 ftom TESTTABLE where columnID=1234" cause an exception "java.lang.StringIndexOutOfBoundsException: String index out of range: 0" if "column1" or "column2" contains has a value '' (void string) so it no null but it contains no chars. The get method CharacterType.get(CharacterType.java:52) is calling java.lang.String.charAt(0) on a String instance with length zero. Steck Trace: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:687) at org.hibernate.type.CharacterType.get(CharacterType.java:52) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:210) at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:497) at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:443) at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:340) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:629) at org.hibernate.loader.Loader.doQuery(Loader.java:724) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)

    Hibernate JIRA | 5 years ago | Luca
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  6. 0

    Using createSQLQuery with query like this "select column1, column2 ftom TESTTABLE where columnID=1234" cause an exception "java.lang.StringIndexOutOfBoundsException: String index out of range: 0" if "column1" or "column2" contains has a value '' (void string) so it no null but it contains no chars. The get method CharacterType.get(CharacterType.java:52) is calling java.lang.String.charAt(0) on a String instance with length zero. Steck Trace: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:687) at org.hibernate.type.CharacterType.get(CharacterType.java:52) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:210) at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:497) at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:443) at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:340) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:629) at org.hibernate.loader.Loader.doQuery(Loader.java:724) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)

    Hibernate JIRA | 5 years ago | Luca
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0

  1. linxiaolong 1 times, last 1 month ago
  2. jokester 1 times, last 1 month ago
  3. tyson925 1 times, last 2 months ago
  4. Torasque 1 times, last 3 months ago
  5. Hronom 32257 times, last 3 months ago
11 more registered users
18 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.StringIndexOutOfBoundsException

    String index out of range: 0

    at java.lang.String.charAt()
  2. Java RT
    String.charAt
    1. java.lang.String.charAt(String.java:686)
    1 frame
  3. Hibernate
    CustomLoader.list
    1. org.hibernate.type.descriptor.java.CharacterTypeDescriptor.wrap(CharacterTypeDescriptor.java:80)
    2. org.hibernate.type.descriptor.java.CharacterTypeDescriptor.wrap(CharacterTypeDescriptor.java:34)
    3. org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
    4. org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
    5. org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
    6. org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
    7. org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:235)
    8. org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:505)
    9. org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:451)
    10. org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:348)
    11. org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:639)
    12. org.hibernate.loader.Loader.doQuery(Loader.java:829)
    13. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
    14. org.hibernate.loader.Loader.doList(Loader.java:2542)
    15. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
    16. org.hibernate.loader.Loader.list(Loader.java:2271)
    17. org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
    17 frames
  4. Hibernate
    SQLQueryImpl.list
    1. org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
    2. org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
    3. org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
    3 frames
  5. Unknown
    EntitlementDTOMapping.main
    1. EntitlementDTOMapping.main(EntitlementDTOMapping.java:22)
    1 frame