mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
[bug SF #2645754 ] SubmissionController is not thread safe
git-svn-id: http://scm.dspace.org/svn/repo/trunk@3505 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -139,9 +139,6 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
private static Logger log = Logger
|
private static Logger log = Logger
|
||||||
.getLogger(SubmissionController.class);
|
.getLogger(SubmissionController.class);
|
||||||
|
|
||||||
/** Configuration of current step in Item Submission Process */
|
|
||||||
private SubmissionStepConfig currentStepConfig;
|
|
||||||
|
|
||||||
|
|
||||||
protected void doDSGet(Context context, HttpServletRequest request,
|
protected void doDSGet(Context context, HttpServletRequest request,
|
||||||
HttpServletResponse response) throws ServletException, IOException,
|
HttpServletResponse response) throws ServletException, IOException,
|
||||||
@@ -245,6 +242,8 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
HttpServletResponse response) throws ServletException, IOException,
|
HttpServletResponse response) throws ServletException, IOException,
|
||||||
SQLException, AuthorizeException
|
SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
|
// Configuration of current step in Item Submission Process
|
||||||
|
SubmissionStepConfig currentStepConfig;
|
||||||
|
|
||||||
//need to find out what type of form we are dealing with
|
//need to find out what type of form we are dealing with
|
||||||
String contentType = request.getContentType();
|
String contentType = request.getContentType();
|
||||||
@@ -292,7 +291,10 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
// First, check for a click on "Cancel/Save" button.
|
// First, check for a click on "Cancel/Save" button.
|
||||||
if (UIUtil.getSubmitButton(request, "").equals(AbstractProcessingStep.CANCEL_BUTTON))
|
if (UIUtil.getSubmitButton(request, "").equals(AbstractProcessingStep.CANCEL_BUTTON))
|
||||||
{
|
{
|
||||||
// forward user to JSP which will confirm
|
// Get the current step
|
||||||
|
currentStepConfig = getCurrentStepConfig(request, subInfo);
|
||||||
|
|
||||||
|
// forward user to JSP which will confirm
|
||||||
// the cancel/save request.
|
// the cancel/save request.
|
||||||
doCancelOrSave(context, request, response, subInfo,
|
doCancelOrSave(context, request, response, subInfo,
|
||||||
currentStepConfig);
|
currentStepConfig);
|
||||||
@@ -319,14 +321,14 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
{
|
{
|
||||||
// user came from the cancel/save page,
|
// user came from the cancel/save page,
|
||||||
// so we need to process that page before proceeding
|
// so we need to process that page before proceeding
|
||||||
processCancelOrSave(context, request, response, subInfo);
|
processCancelOrSave(context, request, response, subInfo, currentStepConfig);
|
||||||
}
|
}
|
||||||
//check for click on "<- Previous" button
|
//check for click on "<- Previous" button
|
||||||
else if (UIUtil.getSubmitButton(request, "").startsWith(
|
else if (UIUtil.getSubmitButton(request, "").startsWith(
|
||||||
AbstractProcessingStep.PREVIOUS_BUTTON))
|
AbstractProcessingStep.PREVIOUS_BUTTON))
|
||||||
{
|
{
|
||||||
// return to the previous step
|
// return to the previous step
|
||||||
doPreviousStep(context, request, response, subInfo);
|
doPreviousStep(context, request, response, subInfo, currentStepConfig);
|
||||||
}
|
}
|
||||||
//check for click on Progress Bar
|
//check for click on Progress Bar
|
||||||
else if (UIUtil.getSubmitButton(request, "").startsWith(
|
else if (UIUtil.getSubmitButton(request, "").startsWith(
|
||||||
@@ -363,6 +365,8 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
throws ServletException, IOException, SQLException,
|
throws ServletException, IOException, SQLException,
|
||||||
AuthorizeException
|
AuthorizeException
|
||||||
{
|
{
|
||||||
|
SubmissionStepConfig currentStepConfig = null;
|
||||||
|
|
||||||
if (subInfo.getSubmissionConfig() != null)
|
if (subInfo.getSubmissionConfig() != null)
|
||||||
{
|
{
|
||||||
// get step to perform
|
// get step to perform
|
||||||
@@ -417,7 +421,7 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
subInfo = getSubmissionInfo(context, request);
|
subInfo = getSubmissionInfo(context, request);
|
||||||
|
|
||||||
//do the next step!
|
//do the next step!
|
||||||
doNextStep(context, request, response, subInfo);
|
doNextStep(context, request, response, subInfo, currentStepConfig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -446,7 +450,7 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
* SubmissionInfo pertaining to this submission
|
* SubmissionInfo pertaining to this submission
|
||||||
*/
|
*/
|
||||||
private void doNextStep(Context context, HttpServletRequest request,
|
private void doNextStep(Context context, HttpServletRequest request,
|
||||||
HttpServletResponse response, SubmissionInfo subInfo)
|
HttpServletResponse response, SubmissionInfo subInfo, SubmissionStepConfig currentStepConfig)
|
||||||
throws ServletException, IOException, SQLException,
|
throws ServletException, IOException, SQLException,
|
||||||
AuthorizeException
|
AuthorizeException
|
||||||
{
|
{
|
||||||
@@ -511,7 +515,7 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
* SubmissionInfo pertaining to this submission
|
* SubmissionInfo pertaining to this submission
|
||||||
*/
|
*/
|
||||||
private void doPreviousStep(Context context, HttpServletRequest request,
|
private void doPreviousStep(Context context, HttpServletRequest request,
|
||||||
HttpServletResponse response, SubmissionInfo subInfo)
|
HttpServletResponse response, SubmissionInfo subInfo, SubmissionStepConfig currentStepConfig)
|
||||||
throws ServletException, IOException, SQLException,
|
throws ServletException, IOException, SQLException,
|
||||||
AuthorizeException
|
AuthorizeException
|
||||||
{
|
{
|
||||||
@@ -742,14 +746,14 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
{
|
{
|
||||||
// call post-processing on Step (to save any inputs from JSP)
|
// call post-processing on Step (to save any inputs from JSP)
|
||||||
log.debug("Cancel/Save Request: calling processing for Step: '"
|
log.debug("Cancel/Save Request: calling processing for Step: '"
|
||||||
+ currentStepConfig.getProcessingClassName() + "'");
|
+ stepConfig.getProcessingClassName() + "'");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// load the step class (using the current class loader)
|
// load the step class (using the current class loader)
|
||||||
ClassLoader loader = this.getClass().getClassLoader();
|
ClassLoader loader = this.getClass().getClassLoader();
|
||||||
Class stepClass = loader
|
Class stepClass = loader
|
||||||
.loadClass(currentStepConfig.getProcessingClassName());
|
.loadClass(stepConfig.getProcessingClassName());
|
||||||
|
|
||||||
// load the JSPStepManager object for this step
|
// load the JSPStepManager object for this step
|
||||||
AbstractProcessingStep step = (AbstractProcessingStep) stepClass
|
AbstractProcessingStep step = (AbstractProcessingStep) stepClass
|
||||||
@@ -765,7 +769,7 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.error("Error loading step class'" + currentStepConfig.getProcessingClassName() + "':", e);
|
log.error("Error loading step class'" + stepConfig.getProcessingClassName() + "':", e);
|
||||||
JSPManager.showInternalError(request, response);
|
JSPManager.showInternalError(request, response);
|
||||||
}
|
}
|
||||||
}//end if not file upload request
|
}//end if not file upload request
|
||||||
@@ -802,7 +806,7 @@ public class SubmissionController extends DSpaceServlet
|
|||||||
*/
|
*/
|
||||||
private void processCancelOrSave(Context context,
|
private void processCancelOrSave(Context context,
|
||||||
HttpServletRequest request, HttpServletResponse response,
|
HttpServletRequest request, HttpServletResponse response,
|
||||||
SubmissionInfo subInfo) throws ServletException, IOException,
|
SubmissionInfo subInfo, SubmissionStepConfig currentStepConfig) throws ServletException, IOException,
|
||||||
SQLException, AuthorizeException
|
SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
String buttonPressed = UIUtil.getSubmitButton(request, "submit_back");
|
String buttonPressed = UIUtil.getSubmitButton(request, "submit_back");
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
(Andrea Bollini)
|
||||||
|
- S.F. Patch 2645776 for Bug 2645754 SubmissionController is not thread safe
|
||||||
|
|
||||||
(Peter Coetzee)
|
(Peter Coetzee)
|
||||||
- S.F Patch 2031532 DAO Singletons
|
- S.F Patch 2031532 DAO Singletons
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user