java.lang.IndexOutOfBoundsException: Index: 395, Size: 386

Atlassian JIRA | Nick Pellow | 5 years ago
  1. 0

    h2.Problem There is no bounds checking when mapping gutter comments to lines of code. This means an entire review explodes with the following error, when the comments somehow don't match the lines in the file. We should handle this more gracefully. {code} 2011-07-13 23:57:34,151 ERROR [btpool0-6324 ] fisheye.app ViewFRXAction-execute - Problem creating FRXDO from frx java.lang.IndexOutOfBoundsException: Index: 395, Size: 386 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at com.cenqua.crucible.view.FRXDO.mapGutterComments(FRXDO.java:861) at com.cenqua.crucible.view.FRXDO.mapInlineComments(FRXDO.java:768) at com.cenqua.crucible.view.FRXDO.<init>(FRXDO.java:198) at com.cenqua.crucible.revision.managers.DefaultContentManager.makeFRXDO(DefaultContentManager.java:104) at com.atlassian.crucible.actions.ReviewBaseAction.makeFRXDO(ReviewBaseAction.java:596) at com.atlassian.crucible.actions.ViewFRXAction.execute(ViewFRXAction.java:184) ... {code} h2.Most probable reason The root cause is not in line calculation algorithm, but in an inconsistent data store. When users move/restore backup of Crucible instance incorrectly, we end up with DB out of sync with the files. This can result in db reusing unique file identifiers and Crucible overwriting a file in its cache. Where we used to have file A, now we have file B. Yet we still think we have file A. In effect, when we load a review for file A, we show contents of file B. If there has been a comment previously added to file A, say on line 395, and file B is only 386 lines long, we throw {{IndexOutOfBoundsException}} when we try to place that comment on file B. h2.{color:red}*Workaround*{color} (!) _This workaround will only work if the source repository is available and running. It will fail if repository is no longer available (including stopped/disabled) or the file originally came from an attachment._ On \*nix you can perform this fix while the instance is running (not sure about Windows). h5. Find CFR number Go to the file that doesn't load properly. {{CFR}} is displayed on the address bar after the '#'. Copy this number. h5.SQL query to find the file names Run the following query, substituting {{<CFR>}} with the number you have just copied: {code:sql}SELECT r.cru_revision AS revision, r.cru_upload_item AS upload_item FROM cru_frx_revision fr, cru_revision r WHERE fr.cru_revision = r.cru_revision_id AND fr.cru_frx_id = <CFR> ORDER BY r.cru_upload_item{code} h5.Delete cache files The last column ({{upload_item}}) gives a list of cache file ids used to display this file (one per revision). Delete files named {{<upload_item>.dat}} from these folders: * {{$FISHEYE_INST/var/tmp/encodedcontent/uploaditem}} * {{$FISHEYE_INST/var/data/uploads}} h5.Reload review page Refresh the review +twice+. You should see the correct files loaded from the repository. h2.Workaround - example In my case the address bar shows {{http://localhost:8080/cru/CR-3#CFR-7}}, so {{CFR = 7}}. The SQL query returns {noformat}revision upload_item -------- ----------- 2000 19 1999 20 31 23 30 24 210 25 211 26{noformat} Then I look for these files: {noformat}$ for CACHE_FOLDER in ./var/tmp/encodedcontent/uploaditem ./var/data/uploads/; do for UPLOAD_ITEM in 19 20 23 24 25 26 ; do find $CACHE_FOLDER -name $UPLOAD_ITEM.dat; done; done ./var/tmp/encodedcontent/uploaditem/00/00/19.dat ./var/tmp/encodedcontent/uploaditem/00/00/20.dat ./var/tmp/encodedcontent/uploaditem/00/00/23.dat ./var/tmp/encodedcontent/uploaditem/00/00/24.dat ./var/tmp/encodedcontent/uploaditem/00/00/25.dat ./var/tmp/encodedcontent/uploaditem/00/00/26.dat ./var/data/uploads//00/00/19.dat ./var/data/uploads//00/00/20.dat ./var/data/uploads//00/00/23.dat ./var/data/uploads//00/00/24.dat ./var/data/uploads//00/00/25.dat ./var/data/uploads//00/00/26.dat{noformat} and delete all of them. Refresh browser twice and voilĂ ! h2.Proper fix Rather than using consecutive numbers as file names, use their hash instead. When loading a file, check the hash matches. If not, invalidate the file store and pull the file from the repository.

    Atlassian JIRA | 5 years ago | Nick Pellow [Atlassian]
    java.lang.IndexOutOfBoundsException: Index: 395, Size: 386
  2. 0

    h2.Problem There is no bounds checking when mapping gutter comments to lines of code. This means an entire review explodes with the following error, when the comments somehow don't match the lines in the file. We should handle this more gracefully. {code} 2011-07-13 23:57:34,151 ERROR [btpool0-6324 ] fisheye.app ViewFRXAction-execute - Problem creating FRXDO from frx java.lang.IndexOutOfBoundsException: Index: 395, Size: 386 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at com.cenqua.crucible.view.FRXDO.mapGutterComments(FRXDO.java:861) at com.cenqua.crucible.view.FRXDO.mapInlineComments(FRXDO.java:768) at com.cenqua.crucible.view.FRXDO.<init>(FRXDO.java:198) at com.cenqua.crucible.revision.managers.DefaultContentManager.makeFRXDO(DefaultContentManager.java:104) at com.atlassian.crucible.actions.ReviewBaseAction.makeFRXDO(ReviewBaseAction.java:596) at com.atlassian.crucible.actions.ViewFRXAction.execute(ViewFRXAction.java:184) ... {code} h2.Most probable reason The root cause is not in line calculation algorithm, but in an inconsistent data store. When users move/restore backup of Crucible instance incorrectly, we end up with DB out of sync with the files. This can result in db reusing unique file identifiers and Crucible overwriting a file in its cache. Where we used to have file A, now we have file B. Yet we still think we have file A. In effect, when we load a review for file A, we show contents of file B. If there has been a comment previously added to file A, say on line 395, and file B is only 386 lines long, we throw {{IndexOutOfBoundsException}} when we try to place that comment on file B. h2.{color:red}*Workaround*{color} (!) _This workaround will only work if the source repository is available and running. It will fail if repository is no longer available (including stopped/disabled) or the file originally came from an attachment._ On \*nix you can perform this fix while the instance is running (not sure about Windows). h5. Find CFR number Go to the file that doesn't load properly. {{CFR}} is displayed on the address bar after the '#'. Copy this number. h5.SQL query to find the file names Run the following query, substituting {{<CFR>}} with the number you have just copied: {code:sql}SELECT r.cru_revision AS revision, r.cru_upload_item AS upload_item FROM cru_frx_revision fr, cru_revision r WHERE fr.cru_revision = r.cru_revision_id AND fr.cru_frx_id = <CFR> ORDER BY r.cru_upload_item{code} h5.Delete cache files The last column ({{upload_item}}) gives a list of cache file ids used to display this file (one per revision). Delete files named {{<upload_item>.dat}} from these folders: * {{$FISHEYE_INST/var/tmp/encodedcontent/uploaditem}} * {{$FISHEYE_INST/var/data/uploads}} h5.Reload review page Refresh the review +twice+. You should see the correct files loaded from the repository. h2.Workaround - example In my case the address bar shows {{http://localhost:8080/cru/CR-3#CFR-7}}, so {{CFR = 7}}. The SQL query returns {noformat}revision upload_item -------- ----------- 2000 19 1999 20 31 23 30 24 210 25 211 26{noformat} Then I look for these files: {noformat}$ for CACHE_FOLDER in ./var/tmp/encodedcontent/uploaditem ./var/data/uploads/; do for UPLOAD_ITEM in 19 20 23 24 25 26 ; do find $CACHE_FOLDER -name $UPLOAD_ITEM.dat; done; done ./var/tmp/encodedcontent/uploaditem/00/00/19.dat ./var/tmp/encodedcontent/uploaditem/00/00/20.dat ./var/tmp/encodedcontent/uploaditem/00/00/23.dat ./var/tmp/encodedcontent/uploaditem/00/00/24.dat ./var/tmp/encodedcontent/uploaditem/00/00/25.dat ./var/tmp/encodedcontent/uploaditem/00/00/26.dat ./var/data/uploads//00/00/19.dat ./var/data/uploads//00/00/20.dat ./var/data/uploads//00/00/23.dat ./var/data/uploads//00/00/24.dat ./var/data/uploads//00/00/25.dat ./var/data/uploads//00/00/26.dat{noformat} and delete all of them. Refresh browser twice and voilĂ ! h2.Proper fix Rather than using consecutive numbers as file names, use their hash instead. When loading a file, check the hash matches. If not, invalidate the file store and pull the file from the repository.

    Atlassian JIRA | 5 years ago | Nick Pellow
    java.lang.IndexOutOfBoundsException: Index: 395, Size: 386
  3. 0

    [error] IndexOutOfBoundsException after clicking commandLink on IceFaces 2.0 alpha 2

    icesoft.org | 11 months ago
    javax.faces.FacesException: Unexpected error restoring state for component with id j_idt3. Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    deleting map in a list then editing another map throws exception

    https://bugzilla.redhat.com/bugzilla/ | 8 years ago | John Mazzitelli
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
  6. 0

    I cannot edit a section of a translated document. I mean, first you must write any content in a page. Then translate the page in another language. Then try to edit one section (not the entire document) of the document. The edit mode loads the full content of the document, and when you try saving, it displays a big error : Error number 0 in 11: Uncaught exception Wrapped Exception: Index: 2, Size: 0 com.xpn.xwiki.XWikiException: Error number 0 in 11: Uncaught exception Wrapped Exception: Index: 2, Size: 0 at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:238) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:129) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:218) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:674) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:462) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:401) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:218) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:163) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:556) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:401) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:450) at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:385) at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:371) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:260) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Wrapped Exception: java.lang.IndexOutOfBoundsException: Index: 2, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at com.xpn.xwiki.doc.XWikiDocument.updateDocumentSection(XWikiDocument.java:6993) at com.xpn.xwiki.web.SaveAction.save(SaveAction.java:119) at com.xpn.xwiki.web.SaveAction.action(SaveAction.java:184) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:213) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:129) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:218) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:674) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:462) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:401) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:218) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:163) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:556) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:401) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:450) at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:385) at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:371) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:260) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Thanks,

    XWiki.org JIRA | 5 years ago | Nicolas Lemoine
    java.lang.IndexOutOfBoundsException: Index: 2, Size: 0

  1. bmacedo 4 times, last 23 hours ago
  2. mhicauber 1 times, last 1 day ago
  3. filpgame 2 times, last 4 days ago
  4. tvrmsmith 1 times, last 5 days ago
  5. Indri Yunita 12 times, last 6 days ago
67 more registered users
28 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.IndexOutOfBoundsException

    Index: 395, Size: 386

    at java.util.ArrayList.RangeCheck()
  2. Java RT
    ArrayList.get
    1. java.util.ArrayList.RangeCheck(ArrayList.java:547)
    2. java.util.ArrayList.get(ArrayList.java:322)
    2 frames
  3. com.cenqua.crucible
    DefaultContentManager.makeFRXDO
    1. com.cenqua.crucible.view.FRXDO.mapGutterComments(FRXDO.java:861)
    2. com.cenqua.crucible.view.FRXDO.mapInlineComments(FRXDO.java:768)
    3. com.cenqua.crucible.view.FRXDO.<init>(FRXDO.java:198)
    4. com.cenqua.crucible.revision.managers.DefaultContentManager.makeFRXDO(DefaultContentManager.java:104)
    4 frames
  4. com.atlassian.crucible
    ViewFRXAction.execute
    1. com.atlassian.crucible.actions.ReviewBaseAction.makeFRXDO(ReviewBaseAction.java:596)
    2. com.atlassian.crucible.actions.ViewFRXAction.execute(ViewFRXAction.java:184)
    2 frames