mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
Merge pull request #1406 from atmire/DS-3146
DS-3146 NPE when starting a new JSPUI submission with BTE metadata import enabled
This commit is contained in:
@@ -79,6 +79,8 @@ public class JSPStartSubmissionLookupStep extends JSPStep
|
|||||||
|
|
||||||
private CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
private CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||||
|
|
||||||
|
private final String DEFAULT_COLLECTION_ID = "-1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do any pre-processing to determine which JSP (if any) is used to generate
|
* Do any pre-processing to determine which JSP (if any) is used to generate
|
||||||
* the UI for this step. This method should include the gathering and
|
* the UI for this step. This method should include the gathering and
|
||||||
@@ -124,13 +126,19 @@ public class JSPStartSubmissionLookupStep extends JSPStep
|
|||||||
* With no parameters, this servlet prepares for display of the Select
|
* With no parameters, this servlet prepares for display of the Select
|
||||||
* Collection JSP.
|
* Collection JSP.
|
||||||
*/
|
*/
|
||||||
UUID collection_id = UIUtil.getUUIDParameter(request, "collection");
|
UUID collection_id = null;
|
||||||
UUID collectionID = UIUtil.getUUIDParameter(request, "collectionid");
|
if(!DEFAULT_COLLECTION_ID.equals(request.getParameter("collection"))) {
|
||||||
|
collection_id = UIUtil.getUUIDParameter(request, "collection");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(collection_id == null && !DEFAULT_COLLECTION_ID.equals(request.getParameter("collectionid"))) {
|
||||||
|
collection_id = UIUtil.getUUIDParameter(request, "collectionid");
|
||||||
|
}
|
||||||
Collection col = null;
|
Collection col = null;
|
||||||
|
|
||||||
if (collectionID != null)
|
if (collection_id != null)
|
||||||
{
|
{
|
||||||
col = collectionService.find(context, collectionID);
|
col = collectionService.find(context, collection_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we already have a valid collection, then we can forward directly
|
// if we already have a valid collection, then we can forward directly
|
||||||
@@ -138,7 +146,7 @@ public class JSPStartSubmissionLookupStep extends JSPStep
|
|||||||
if (col != null)
|
if (col != null)
|
||||||
{
|
{
|
||||||
log.debug("Select Collection page skipped, since a Collection ID was already found. Collection ID="
|
log.debug("Select Collection page skipped, since a Collection ID was already found. Collection ID="
|
||||||
+ collectionID);
|
+ collection_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -162,8 +170,14 @@ public class JSPStartSubmissionLookupStep extends JSPStep
|
|||||||
|
|
||||||
// save collections to request for JSP
|
// save collections to request for JSP
|
||||||
request.setAttribute("collections", collections);
|
request.setAttribute("collections", collections);
|
||||||
request.setAttribute("collection_id", collection_id);
|
|
||||||
request.setAttribute("collectionID", collectionID);
|
if(collection_id!=null) {
|
||||||
|
request.setAttribute("collection_id", collection_id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
request.setAttribute("collection_id", DEFAULT_COLLECTION_ID);
|
||||||
|
}
|
||||||
|
request.setAttribute("collectionID", collection_id);
|
||||||
|
|
||||||
Map<String, List<String>> identifiers2providers = slService
|
Map<String, List<String>> identifiers2providers = slService
|
||||||
.getProvidersIdentifiersMap();
|
.getProvidersIdentifiersMap();
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
<%@ page import="org.dspace.content.Collection" %>
|
<%@ page import="org.dspace.content.Collection" %>
|
||||||
<%@ page import="java.lang.Boolean" %>
|
<%@ page import="java.lang.Boolean" %>
|
||||||
<%@ page import="java.util.List" %>
|
<%@ page import="java.util.*" %>
|
||||||
<%@ page import="java.util.Map" %>
|
|
||||||
|
|
||||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
|
||||||
prefix="c" %>
|
prefix="c" %>
|
||||||
@@ -42,8 +41,18 @@
|
|||||||
(List<Collection>) request.getAttribute("collections");
|
(List<Collection>) request.getAttribute("collections");
|
||||||
|
|
||||||
//get collection id from the collection home
|
//get collection id from the collection home
|
||||||
String collection_id = (String) request.getAttribute("collection_id");
|
Object collection_id_object = request.getAttribute("collection_id");
|
||||||
|
|
||||||
|
String collection_id;
|
||||||
|
|
||||||
|
if(collection_id_object instanceof UUID){
|
||||||
|
UUID uuid = (UUID) collection_id_object;
|
||||||
|
collection_id = uuid.toString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
collection_id = (String) collection_id_object;
|
||||||
|
}
|
||||||
|
|
||||||
//check if we need to display the "no collection selected" error
|
//check if we need to display the "no collection selected" error
|
||||||
Boolean noCollection = (Boolean) request.getAttribute("no.collection");
|
Boolean noCollection = (Boolean) request.getAttribute("no.collection");
|
||||||
Boolean nosuuid = (Boolean) request.getAttribute("nouuid");
|
Boolean nosuuid = (Boolean) request.getAttribute("nouuid");
|
||||||
|
Reference in New Issue
Block a user