NPE from BaseHibernateManager.getVisibleExternalAssignments

Description

In trunk, BaseHibernateManager has the method getVisibleExternalAssignments. When this line of code is called:

Map<String, List<String>> allExternals = externalAssessmentService.getVisibleExternalAssignments(gradebookUid, studentIds);

it throws a NPE because externalAssessmentService is null. It has not been correctly injected.

In previous versions of this code, the method appeared in GradebookServiceHibernateImpl.java, which is correctly wired up in components.xml. In r118469 (for https://sakaiproject.atlassian.net/browse/SAK-22978#icft=SAK-22978), this was moved and not wired up correctly causing these method calls to fail.

Activity

Show:

Noah Botimer November 23, 2015 at 3:34 PM

Let me know if this is still a problem. I never heard of anyone else running into it and am not especially inclined to go back for a change at this point. If it is causing problems, please reopen.

Steve Swinsburg September 11, 2013 at 10:29 PM

Prior to 2.9, the externalAssessmentService was injected into GradebookServiceHibernateImpl - now it is in both GradebookServiceHibernateImpl and BaseHibernateManager. A call to gradebookService.finalizeGrades(gradebookUid) ultimately triggers this bit of code in BaseHibernateManager and it throws the NPE.

So what I am saying is that in 2.8 I could call gradebookService.finalizeGrades(gradebookUid) no problem, now it throws an NPE because it goes via this bit of code which is broken - the injection of this dependency is not working and as a result it is null.

Noah Botimer September 11, 2013 at 9:00 AM

Please forgive me, but I don't understand how it could have worked in 2.8. The entire method that contains the line that could traverse a null externalAssessmentService is new for 2.9.

It's a protected method on the abstract base class, too, so I don't know what bean you would be calling it through, nor which one you mean is missing the injection. There are a few beans that inherit from BaseHibernateManager (including the actual GradebookExternalAssessmentService, for which injecting itself is problematic). I absolutely admit that this is clunky, but I am not sure what specific problem you are suggesting we should fix – it seems that all cases in the core succeed, so I need a real case to consider to calibrate the refactoring effort.

Steve Swinsburg September 10, 2013 at 6:46 PM

Its most likely that this code is not being used at the moment, since the dependency is not being injected and will always throw the NPE.

This would not cause startup or compile issues, only when the code is explicitly called.

But this particular method call did used to work in 2.8.

Sam Ottenhoff September 10, 2013 at 8:16 AM

We're not seeing this in 2.9.x nightly builds and didn't run into this during 2.9.3 QA testing. Are you sure this is a general issue?

Won't Fix

Details

Priority

Affects versions

Components

Assignee

Reporter

Labels

Created September 10, 2013 at 6:21 AM
Updated February 8, 2016 at 11:13 AM
Resolved November 23, 2015 at 3:34 PM

Flag notifications