Use the WADF from the request, not from the context.
It will never be null.
This commit is contained in:
parent
345f99790f
commit
fcbe59dcf6
1 changed files with 4 additions and 19 deletions
|
@ -26,6 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.Authenticate;
|
import edu.cornell.mannlib.vitro.webapp.controller.edit.Authenticate;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess.FactoryID;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.LoginEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.LoginEvent;
|
||||||
|
@ -263,12 +264,7 @@ public class BasicAuthenticator extends Authenticator {
|
||||||
* Get a reference to the UserAccountsDao, or null.
|
* Get a reference to the UserAccountsDao, or null.
|
||||||
*/
|
*/
|
||||||
private UserAccountsDao getUserAccountsDao() {
|
private UserAccountsDao getUserAccountsDao() {
|
||||||
WebappDaoFactory wadf = getWebappDaoFactory();
|
UserAccountsDao userAccountsDao = getWebappDaoFactory().getUserAccountsDao();
|
||||||
if (wadf == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserAccountsDao userAccountsDao = wadf.getUserAccountsDao();
|
|
||||||
if (userAccountsDao == null) {
|
if (userAccountsDao == null) {
|
||||||
log.error("getUserAccountsDao: no UserAccountsDao");
|
log.error("getUserAccountsDao: no UserAccountsDao");
|
||||||
}
|
}
|
||||||
|
@ -280,12 +276,7 @@ public class BasicAuthenticator extends Authenticator {
|
||||||
* Get a reference to the IndividualDao, or null.
|
* Get a reference to the IndividualDao, or null.
|
||||||
*/
|
*/
|
||||||
private IndividualDao getIndividualDao() {
|
private IndividualDao getIndividualDao() {
|
||||||
WebappDaoFactory wadf = getWebappDaoFactory();
|
IndividualDao individualDao = getWebappDaoFactory().getIndividualDao();
|
||||||
if (wadf == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IndividualDao individualDao = wadf.getIndividualDao();
|
|
||||||
if (individualDao == null) {
|
if (individualDao == null) {
|
||||||
log.error("getIndividualDao: no IndividualDao");
|
log.error("getIndividualDao: no IndividualDao");
|
||||||
}
|
}
|
||||||
|
@ -297,13 +288,7 @@ public class BasicAuthenticator extends Authenticator {
|
||||||
* Get a reference to the WebappDaoFactory, or null.
|
* Get a reference to the WebappDaoFactory, or null.
|
||||||
*/
|
*/
|
||||||
private WebappDaoFactory getWebappDaoFactory() {
|
private WebappDaoFactory getWebappDaoFactory() {
|
||||||
HttpSession session = request.getSession(false);
|
return ModelAccess.on(request).getWebappDaoFactory();
|
||||||
if (session == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ServletContext servletContext = session.getServletContext();
|
|
||||||
return ModelAccess.on(servletContext).getWebappDaoFactory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue