IndexOutOfBoundsException (v3.0.4)
See original GitHub issuejava.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at java.util.Collections$UnmodifiableList.get(Collections.java:1309)
at org.javers.repository.sql.finders.CdoSnapshotFinder.lambda$getLatest$1(CdoSnapshotFinder.java:54)
at org.javers.repository.sql.finders.CdoSnapshotFinder.getLatest(CdoSnapshotFinder.java:52)
at org.javers.repository.sql.JaversSqlRepository.getLatest(JaversSqlRepository.java:46)
at org.javers.repository.api.JaversExtendedRepository.getLatest(JaversExtendedRepository.java:81)
at org.javers.core.snapshot.GraphShadowFactory.createLatestShadow(GraphShadowFactory.java:29)
at org.javers.core.snapshot.GraphSnapshotFacade.createLatestShadow(GraphSnapshotFacade.java:22)
at org.javers.core.commit.CommitFactory.create(CommitFactory.java:68)
at org.javers.core.JaversCore.commit(JaversCore.java:80)
at org.javers.spring.jpa.JaversTransactionalDecorator.commit(JaversTransactionalDecorator.java:63)
at org.javers.spring.jpa.JaversTransactionalDecorator$$FastClassBySpringCGLIB$$acb40bd0.invoke(<generated>)
at org.javers.spring.jpa.JaversTransactionalDecorator$$EnhancerBySpringCGLIB$$7578d67f.commit(<generated>)
at org.javers.spring.auditable.aspect.springdata.OnSaveAuditChangeHandler.handle(OnSaveAuditChangeHandler.java:18)
at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.applyVersionChange(JaversSpringDataAuditableRepositoryAspect.java:80)
at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.applyVersionChanges(JaversSpringDataAuditableRepositoryAspect.java:75)
at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.lambda$onVersionEvent$0(JaversSpringDataAuditableRepositoryAspect.java:56)
at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.onVersionEvent(JaversSpringDataAuditableRepositoryAspect.java:53)
at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.onSaveExecuted(JaversSpringDataAuditableRepositoryAspect.java:47)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Exception in thread "main" java.lang ...
While executing below code I'm getting: (Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 3, Size: 3).
Read more >java.lang.IndexOutOfBoundsException: Index: 46, Size: 46
Hey, I've recently opened a new 1.7.10 server with over 130 mods, numerous people have been having the same crash and I have...
Read more >EWAHCompressedBitmap (JavaEWAH 0.6.0 API) - Javadoc.io
This implements the patent-free(1) EWAH scheme. Roughly speaking, it is a 64-bit variant of the BBC compression scheme used by Oracle for its...
Read more >java.lang.IndexOutOfBoundsException: Index: 3999, Size: 4000 ...
And update forge while you're at it. EnderIO: No known problems detected. ... GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because...
Read more >IndexOutOfBoundsException while reading large TIFF file
1 Standard GIF image reader · 2 Standard BMP Image Reader · 3 Standard WBMP Image Reader · 4 Standard PNG image reader...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Had same problem, after looking at source code can say, that IndexOutOfBoundsException happens when you try to rerun your application and first action (in my case) is trying to view audit change detail.
Want you to notice, that in this case in
javers/javers-persistence-sql/src/main/java/org/javers/repository/sql/repositories/GlobalIdRepository.javain this method:Instead of taking value from cache it goes to
findGlobalIdPkInDB(globalId)method as you can see. So, basically, to recreate this bug you must trigger this method.So the problem is in
jsonConverter.toJson(((InstanceId)globalId).getCdoId())in this section offindGlobalIdPkInDB(globalId)method (don’t know about other cases).Argument
localIdis becomes like, for example,""1111""instead of"1111"so querying DB returns nothing. I think thatjsonConverter.toJson(((InstanceId)globalId).getCdoId())causes it and it must be replaced with justglobalId.getCdoId()to prevent problem so it looks like this:I am using PostgreSQL DB, if it might help to resolve this problem.
This issue is the same with issue I just report few minutes ago (https://github.com/javers/javers/issues/685) Your test case alway pass because before you already call javers.commit() before, and it stored in cache.
To reproduce this issue, you can try with some step as below