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

Hibernate JIRA | Tim Schafer | 1 decade 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

    The get method of CharacterType is calling java.lang.String.charAt(0) on a String instance that has zero length This resulted rom trying to load a mapped object from a Mysql 4.0.13 record that has a blank column Sep 4, 2003 8:55:27 AM net.sf.hibernate.impl.IteratorImpl next SEVERE: could not get next result java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at net.sf.hibernate.type.CharacterType.get(CharacterType.java:19) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51) at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:139) at net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersister.java:377) at net.sf.hibernate.collection.Set.readFrom(Set.java:242) at net.sf.hibernate.loader.Loader.doFind(Loader.java:175) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602) at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82) at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897) at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128) at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74) at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1716) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:109) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:57) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:70) at test.TestHibernate.main(TestHibernate.java:94) java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at net.sf.hibernate.type.CharacterType.get(CharacterType.java:19) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51) at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:139) at net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersister.java:377) at net.sf.hibernate.collection.Set.readFrom(Set.java:242) at net.sf.hibernate.loader.Loader.doFind(Loader.java:175) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602) at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82) at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897) at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128) at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74) at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1716) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:109) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:57) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:70) at test.TestHibernate.main(TestHibernate.java:94) rethrown as net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem: String index out of range: 0 at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:81) at test.TestHibernate.main(TestHibernate.java:94) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at net.sf.hibernate.type.CharacterType.get(CharacterType.java:19) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51) at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:139) at net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersister.java:377) at net.sf.hibernate.collection.Set.readFrom(Set.java:242) at net.sf.hibernate.loader.Loader.doFind(Loader.java:175) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602) at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82) at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897) at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128) at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74) at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1716) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:109) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:57) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:70) ... 1 more

    Hibernate JIRA | 1 decade ago | Tim Schafer
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  2. 0

    The get method of CharacterType is calling java.lang.String.charAt(0) on a String instance that has zero length This resulted rom trying to load a mapped object from a Mysql 4.0.13 record that has a blank column Sep 4, 2003 8:55:27 AM net.sf.hibernate.impl.IteratorImpl next SEVERE: could not get next result java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at net.sf.hibernate.type.CharacterType.get(CharacterType.java:19) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51) at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:139) at net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersister.java:377) at net.sf.hibernate.collection.Set.readFrom(Set.java:242) at net.sf.hibernate.loader.Loader.doFind(Loader.java:175) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602) at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82) at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897) at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128) at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74) at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1716) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:109) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:57) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:70) at test.TestHibernate.main(TestHibernate.java:94) java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at net.sf.hibernate.type.CharacterType.get(CharacterType.java:19) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51) at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:139) at net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersister.java:377) at net.sf.hibernate.collection.Set.readFrom(Set.java:242) at net.sf.hibernate.loader.Loader.doFind(Loader.java:175) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602) at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82) at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897) at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128) at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74) at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1716) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:109) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:57) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:70) at test.TestHibernate.main(TestHibernate.java:94) rethrown as net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem: String index out of range: 0 at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:81) at test.TestHibernate.main(TestHibernate.java:94) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at net.sf.hibernate.type.CharacterType.get(CharacterType.java:19) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51) at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:139) at net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersister.java:377) at net.sf.hibernate.collection.Set.readFrom(Set.java:242) at net.sf.hibernate.loader.Loader.doFind(Loader.java:175) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602) at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82) at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897) at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128) at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74) at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1716) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:109) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:57) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:70) ... 1 more

    Hibernate JIRA | 1 decade ago | Tim Schafer
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  3. 0

    Problem trying to use SnippetType.CAMELCASE setting in eclipse

    GitHub | 2 years ago | tjfbirch
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Creatng a simple text menu: String out of bonds expection ( range 0 ) Java

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

  1. tyson925 1 times, last 1 month ago
  2. Torasque 1 times, last 2 months ago
  3. Hronom 32257 times, last 2 months ago
  4. filpgame 6 times, last 2 months ago
  5. harshg 2 times, last 5 months ago
9 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(Unknown Source)
    1 frame
  3. net.sf.hibernate
    IteratorImpl.next
    1. net.sf.hibernate.type.CharacterType.get(CharacterType.java:19)
    2. net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59)
    3. net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51)
    4. net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:139)
    5. net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersister.java:377)
    6. net.sf.hibernate.collection.Set.readFrom(Set.java:242)
    7. net.sf.hibernate.loader.Loader.doFind(Loader.java:175)
    8. net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602)
    9. net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82)
    10. net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897)
    11. net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128)
    12. net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74)
    13. net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177)
    14. net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959)
    15. net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
    16. net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587)
    17. net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
    18. net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396)
    19. net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889)
    20. net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757)
    21. net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1716)
    22. net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62)
    23. net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:109)
    24. net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:57)
    25. net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:70)
    25 frames
  4. test
    TestHibernate.main
    1. test.TestHibernate.main(TestHibernate.java:94)
    1 frame