Summary - The proxy throws an JSONException each time it tries to fetch data from a moodle instance where it can't get the user grades. We need some error handling here.
Bug Details
What? - Error when getting user grades.
Where? - Instance running in our kubernetes cluster connected to a moodle instance without moodle plugin.
When?/How often? - Every time the proxy tries to stream the data
How?/Current state - The error log should help:
Error while reaching core_enrol_get_enrolled_users:[Ljava.lang.StackTraceElement;@b8feec0
org.json.JSONException: JSONObject["usergrades"] not found.
at org.json.JSONObject.get(JSONObject.java:566)
at org.json.JSONObject.getJSONArray(JSONObject.java:760)
at i5.las2peer.services.moodleDataProxyService.moodleData.MoodleWebServiceConnection.gradereport_user_get_grade_items(MoodleWebServiceConnection.java:187)
at i5.las2peer.services.moodleDataProxyService.moodleData.MoodleStatementGenerator.getSubmissions(MoodleStatementGenerator.java:162)
at i5.las2peer.services.moodleDataProxyService.moodleData.MoodleStatementGenerator.courseUpdatesSince(MoodleStatementGenerator.java:99)
at i5.las2peer.services.moodleDataProxyService.MoodleDataProxyService$DataStreamThread.run(MoodleDataProxyService.java:278)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at rice.p2p.past.messaging.MessageLostMessage.returnResponse(MessageLostMessage.java:105)
at rice.p2p.past.PastImpl.handleResponse(PastImpl.java:585)
at rice.p2p.past.PastImpl.deliver(PastImpl.java:1015)
at rice.pastry.commonapi.PastryEndpoint.messageForAppl(PastryEndpoint.java:502)
at rice.pastry.commonapi.PastryEndpoint.receiveMessage(PastryEndpoint.java:594)
at rice.pastry.messaging.MessageDispatch.dispatchMessage(MessageDispatch.java:156)
at rice.pastry.PastryNode.receiveMessage(PastryNode.java:472)
at rice.pastry.ScheduledMessage.run(ScheduledMessage.java:87)
at rice.selector.TimerTask.execute(TimerTask.java:71)
at rice.selector.SelectorManager.executeTask(SelectorManager.java:761)
at rice.selector.SelectorManager.executeDueTasks(SelectorManager
Have a look here.