java.util.NoSuchElementException: Cannot access index 1 when size is 0. Remember to check hasNext() before using next().

GitHub | biagionicp | 3 months ago
  1. 0

    GitHub comment 2660#247835522

    GitHub | 3 months ago | biagionicp
    java.util.NoSuchElementException: Cannot access index 1 when size is 0. Remember to check hasNext() before using next().
  2. 0

    [Support case|https://support.atlassian.com/browse/CRC-2708] was getting errors at the URL: {code} http://crucible/search/repo/trunk?ql=select%20revisions%20from%20dir%20%2Ftrunk%20where%20%28in%20any%20review%29%20order%20by%20date%20desc%20group%20by%20changeset%20return%20csid%2C%20author%2C%20date%2C%20comment%2C%20count%28revisions%29%20%0D%0Alimit%2050 {code} which corresponds with the query {code} select revisions from dir /core/trunk where (in any review) order by date desc group by changeset return csid, author, date, comment, count(revisions) limit 50 {code} And getting the following stack trace: {code} 17:25:09 ERROR - Nested in javax.servlet.jsp.JspException: java.lang.RuntimeException: java.util.NoSuchElementException: !hasNext(): java.lang.RuntimeException: java.util.NoSuchElementException: !hasNext() at com.cenqua.fisheye.web.SearchResultsExplorer$TabularRowDetailIterator.next(SearchResultsExplorer.java:139) at com.cenqua.fisheye.web.SearchResultsExplorer$TabularRowDetailIterator.next(SearchResultsExplorer.java:112) at org.apache.taglibs.standard.tag.common.core.ForEachSupport$SimpleForEachIterator.next(ForEachSupport.java:149) at org.apache.taglibs.standard.tag.common.core.ForEachSupport.next(ForEachSupport.java:171) at javax.servlet.jsp.jstl.core.LoopTagSupport.doAfterBody(LoopTagSupport.java:326) at org.apache.jsp.tag.web.cru.search.resultlist_005ftabular_tag._jspx_meth_c_forEach_1(resultlist_005ftabular_tag.java:324) at org.apache.jsp.tag.web.cru.search.resultlist_005ftabular_tag.doTag(resultlist_005ftabular_tag.java:154) at org.apache.jsp.tag.web.cru.search.resultlist_tag._jspx_meth_search_resultlist_tabular_0(resultlist_tag.java:194) at org.apache.jsp.tag.web.cru.search.resultlist_tag.doTag(resultlist_tag.java:131) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_search_resultlist_0(searchresults_jsp.java:1487) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_c_otherwise_1(searchresults_jsp.java:1455) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_c_choose_2(searchresults_jsp.java:1399) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_c_if_5(searchresults_jsp.java:1368) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp.access$1600(searchresults_jsp.java:7) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp$searchresults_jspHelper.invoke9(searchresults_jsp.java:1629) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp$searchresults_jspHelper.invoke(searchresults_jsp.java:1681) at org.apache.jsp.tag.web.cru.threePanelPageContent_tag.doTag(threePanelPageContent_tag.java:590) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_rend_threePanelPageContent_0(searchresults_jsp.java:627) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspService(searchresults_jsp.java:195) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1272) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.crucible.filters.CrucibleFilter.doFilter(CrucibleFilter.java:141) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.TotalityFilter.doFilter(TotalityFilter.java:192) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126) at com.cenqua.fisheye.web.SearchRepositoryServlet.doSearch(SearchRepositoryServlet.java:131) at com.cenqua.fisheye.web.SearchRepositoryServlet.handleRequest(SearchRepositoryServlet.java:58) at com.cenqua.fisheye.web.BaseAction.processRequest(BaseAction.java:247) at com.cenqua.fisheye.web.ActionDispatcherServlet.doIt(ActionDispatcherServlet.java:237) at com.cenqua.fisheye.web.ActionDispatcherServlet.doGet(ActionDispatcherServlet.java:68) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1272) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.crucible.filters.CrucibleFilter.doFilter(CrucibleFilter.java:141) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.TotalityFilter.doFilter(TotalityFilter.java:252) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:78) at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:131) at com.cenqua.fisheye.web.filters.CustomIncludableGzipFilter.doFilter(CustomIncludableGzipFilter.java:21) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.ProductInfoFilter.doFilter(ProductInfoFilter.java:36) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.UpfrontFilter.doFilter(UpfrontFilter.java:52) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.fecru.profiling.ProfilingServletFilter.doFilter(ProfilingServletFilter.java:73) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451) Caused by: java.util.NoSuchElementException: !hasNext() at com.cenqua.fisheye.search.SearchResults$GroupAggregateTabularResultsIterator.nextRow(SearchResults.java:293) at com.cenqua.fisheye.web.SearchResultsExplorer$TabularRowDetailIterator.next(SearchResultsExplorer.java:133) ... 133 more {code} Looking at the code we're using {{SearchAction.getFilteredReviewIds().size()}} to determine the number of results for paging. Unfortunately we're also using this number in {{SearchResultsExplorer}} in a {{TabularRowDetailIterator}} to calculate the {{hasNext}} of the results. Meanwhile the actual results for {{TabularRowDetailIterator}} are grabbed by {{SearchRepositoryServlet}} using other logic, and in this case, the number of results doesn't match.

    Atlassian JIRA | 5 years ago | Adam Ahmed [Atlassian]
    java.lang.RuntimeException: java.util.NoSuchElementException: !hasNext()
  3. 0

    [Support case|https://support.atlassian.com/browse/CRC-2708] was getting errors at the URL: {code} http://crucible/search/repo/trunk?ql=select%20revisions%20from%20dir%20%2Ftrunk%20where%20%28in%20any%20review%29%20order%20by%20date%20desc%20group%20by%20changeset%20return%20csid%2C%20author%2C%20date%2C%20comment%2C%20count%28revisions%29%20%0D%0Alimit%2050 {code} which corresponds with the query {code} select revisions from dir /core/trunk where (in any review) order by date desc group by changeset return csid, author, date, comment, count(revisions) limit 50 {code} And getting the following stack trace: {code} 17:25:09 ERROR - Nested in javax.servlet.jsp.JspException: java.lang.RuntimeException: java.util.NoSuchElementException: !hasNext(): java.lang.RuntimeException: java.util.NoSuchElementException: !hasNext() at com.cenqua.fisheye.web.SearchResultsExplorer$TabularRowDetailIterator.next(SearchResultsExplorer.java:139) at com.cenqua.fisheye.web.SearchResultsExplorer$TabularRowDetailIterator.next(SearchResultsExplorer.java:112) at org.apache.taglibs.standard.tag.common.core.ForEachSupport$SimpleForEachIterator.next(ForEachSupport.java:149) at org.apache.taglibs.standard.tag.common.core.ForEachSupport.next(ForEachSupport.java:171) at javax.servlet.jsp.jstl.core.LoopTagSupport.doAfterBody(LoopTagSupport.java:326) at org.apache.jsp.tag.web.cru.search.resultlist_005ftabular_tag._jspx_meth_c_forEach_1(resultlist_005ftabular_tag.java:324) at org.apache.jsp.tag.web.cru.search.resultlist_005ftabular_tag.doTag(resultlist_005ftabular_tag.java:154) at org.apache.jsp.tag.web.cru.search.resultlist_tag._jspx_meth_search_resultlist_tabular_0(resultlist_tag.java:194) at org.apache.jsp.tag.web.cru.search.resultlist_tag.doTag(resultlist_tag.java:131) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_search_resultlist_0(searchresults_jsp.java:1487) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_c_otherwise_1(searchresults_jsp.java:1455) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_c_choose_2(searchresults_jsp.java:1399) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_c_if_5(searchresults_jsp.java:1368) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp.access$1600(searchresults_jsp.java:7) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp$searchresults_jspHelper.invoke9(searchresults_jsp.java:1629) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp$searchresults_jspHelper.invoke(searchresults_jsp.java:1681) at org.apache.jsp.tag.web.cru.threePanelPageContent_tag.doTag(threePanelPageContent_tag.java:590) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspx_meth_rend_threePanelPageContent_0(searchresults_jsp.java:627) at org.apache.jsp.WEB_002dINF.jsp.search.searchresults_jsp._jspService(searchresults_jsp.java:195) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1272) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.crucible.filters.CrucibleFilter.doFilter(CrucibleFilter.java:141) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.TotalityFilter.doFilter(TotalityFilter.java:192) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126) at com.cenqua.fisheye.web.SearchRepositoryServlet.doSearch(SearchRepositoryServlet.java:131) at com.cenqua.fisheye.web.SearchRepositoryServlet.handleRequest(SearchRepositoryServlet.java:58) at com.cenqua.fisheye.web.BaseAction.processRequest(BaseAction.java:247) at com.cenqua.fisheye.web.ActionDispatcherServlet.doIt(ActionDispatcherServlet.java:237) at com.cenqua.fisheye.web.ActionDispatcherServlet.doGet(ActionDispatcherServlet.java:68) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1272) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.crucible.filters.CrucibleFilter.doFilter(CrucibleFilter.java:141) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.TotalityFilter.doFilter(TotalityFilter.java:252) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:78) at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:131) at com.cenqua.fisheye.web.filters.CustomIncludableGzipFilter.doFilter(CustomIncludableGzipFilter.java:21) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.ProductInfoFilter.doFilter(ProductInfoFilter.java:36) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.cenqua.fisheye.web.filters.UpfrontFilter.doFilter(UpfrontFilter.java:52) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at com.atlassian.fecru.profiling.ProfilingServletFilter.doFilter(ProfilingServletFilter.java:73) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1264) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451) Caused by: java.util.NoSuchElementException: !hasNext() at com.cenqua.fisheye.search.SearchResults$GroupAggregateTabularResultsIterator.nextRow(SearchResults.java:293) at com.cenqua.fisheye.web.SearchResultsExplorer$TabularRowDetailIterator.next(SearchResultsExplorer.java:133) ... 133 more {code} Looking at the code we're using {{SearchAction.getFilteredReviewIds().size()}} to determine the number of results for paging. Unfortunately we're also using this number in {{SearchResultsExplorer}} in a {{TabularRowDetailIterator}} to calculate the {{hasNext}} of the results. Meanwhile the actual results for {{TabularRowDetailIterator}} are grabbed by {{SearchRepositoryServlet}} using other logic, and in this case, the number of results doesn't match.

    Atlassian JIRA | 5 years ago | Adam Ahmed [Atlassian]
    java.lang.RuntimeException: java.util.NoSuchElementException: !hasNext()
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    RtGistITCase failing because user has not gists

    GitHub | 3 years ago | hariso
    java.util.NoSuchElementException: no more elements in pagination, use #hasNext()
  6. 0

    NoSuchElementException when generating DOT file

    GitHub | 3 years ago | kscaldef
    java.util.NoSuchElementException: next on empty iterator

    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.util.NoSuchElementException

      Cannot access index 1 when size is 0. Remember to check hasNext() before using next().

      at io.realm.RealmList$RealmItr.next()
    2. io.realm
      RealmList$RealmItr.next
      1. io.realm.RealmList$RealmItr.next(RealmList.java:818)
      2. io.realm.RealmList$RealmItr.next(RealmList.java:775)
      2 frames