Repository navigation
Conversation
getProjectComponent() returns null when the run's project has no such node or component, and the ClassmateDataController subclasses that call it read the result without checking. A request naming a missing component, such as the one the client sends for a Discussion whose connected component has not been chosen yet (componentId "null"), threw NullPointerException and was answered with HTTP 500. Each controller now answers a missing component the way it already answers a component that does not qualify. isComponentType(), which ClassmateDiscussionDataController uses, and the component checks in ClassmateGraphDataController and PeerGroupWorkController treat it as a component of the wrong type, so the request is refused with AccessDeniedException, as ClassmateSummaryDataController already does for a component that is not in the project. PeerGroupStudentWorkAnnotationController returns an empty list, as it does when the referenced component is neither MultipleChoice nor OpenResponse; this covers both the requested component and the component it references. No student work or annotations are looked up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requests for classmate or peer-group work that name a node or component missing from the run's project are answered with HTTP 500.
getProjectComponent()returns null in that case, and theClassmateDataControllersubclasses read the result without checking, so they throwNullPointerException.The client sends such a request for a Discussion whose connected component was left half configured in the authoring tool: the URL ends in
/node2/null. The 500 leaves the Discussion empty for students, including their own earlier posts, and fills the server log with stack traces.Changes
Each controller answers a missing component the way it already answers a component that does not qualify, so valid and wrong-type requests behave as before, and the check still runs after the run, period and peer-group authorization.
isComponentType(), used byClassmateDiscussionDataController, and the component checks inClassmateGraphDataControllerandPeerGroupWorkControllertreat it as a component of the wrong type and refuse the request withAccessDeniedException, asClassmateSummaryDataControlleralready does for a component not in the project.PeerGroupStudentWorkAnnotationControllerreturns an empty list, as it does when the referenced component is neither MultipleChoice nor OpenResponse. This covers both the requested component and the component it references.Test
ClassmateDiscussionDataControllerTest,ClassmateGraphDataControllerTest,PeerGroupStudentWorkAnnotationControllerTestand a newPeerGroupWorkControllerTest. Against the currentdevelop, all six fail withNullPointerException: Cannot invoke "ProjectComponent.getString(String)" because "projectComponent" is nullor the equivalent.PeerGroupWorkControllerTestalso pins the existing wrong-type response.Classmate*andPeerGroup*controller tests pass (76).