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

Hibernate JIRA | Luca | 4 years ago
  1. 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 | 4 years ago | Luca
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  2. 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 | 4 years ago | Luca
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  3. 0

    Hibernate, Null values and nativeSQL

    Stack Overflow | 7 years ago | gotch4
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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
  6. 0

    Hibernate Transform Failiing... :(

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

  1. harshg 2 times, last 2 months ago
  2. balintn 4 times, last 3 months ago
  3. poroszd 1 times, last 3 months ago
  4. Stefan Braune 1 times, last 5 months ago
  5. mauritius 1 times, last 5 months ago
6 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:687)
    1 frame
  3. Hibernate
    CustomLoader.list
    1. org.hibernate.type.CharacterType.get(CharacterType.java:52)
    2. org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
    3. org.hibernate.type.NullableType.nullSafeGet(NullableType.java:210)
    4. org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:497)
    5. org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:443)
    6. org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:340)
    7. org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:629)
    8. org.hibernate.loader.Loader.doQuery(Loader.java:724)
    9. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    10. org.hibernate.loader.Loader.doList(Loader.java:2228)
    11. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
    12. org.hibernate.loader.Loader.list(Loader.java:2120)
    13. org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
    13 frames
  4. Hibernate
    SQLQueryImpl.list
    1. org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
    2. org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
    3. org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
    3 frames