TEAMMATES / teammates

This is the project website for the TEAMMATES feedback management tool for education
https://teammatesv4.appspot.com/
GNU General Public License v2.0
1.63k stars 3.26k forks source link

IndexOutOfBoundsException encountered by LogsProcessor #13109

Closed damithc closed 3 weeks ago

damithc commented 2 months ago

V9-0-0-beta.6

Found in production server logs. Happened at least 3 times so far within last 24 hours

Error Message: IndexOutOfBoundsException caught by WebApiServlet: Index -1 out of bounds for length 0
caused by java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.util.Objects.checkIndex(Objects.java:372)
at java.util.ArrayList.get(ArrayList.java:459)
at teammates.logic.api.LogsProcessor.getNumberOfLogsForEvent(LogsProcessor.java:88)
at teammates.ui.webapi.CalculateUsageStatisticsAction.execute(CalculateUsageStatisticsAction.java:30)
at teammates.ui.webapi.CalculateUsageStatisticsAction.execute(CalculateUsageStatisticsAction.java:17)
at teammates.ui.servlets.WebApiServlet.executeWithTransaction(WebApiServlet.java:128)
at teammates.ui.servlets.WebApiServlet.invokeServlet(WebApiServlet.java:66)
at teammates.ui.servlets.WebApiServlet.doGet(WebApiServlet.java:38)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:500)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
at ...
damithc commented 2 months ago

Still happening, a few times a day.

Ashwinn11 commented 1 month ago

This can be fixed by just adding a check whether the list is empty or not. Can I work on this?