bug fixing uploading on VRE Folder

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@176837 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-01-29 09:45:36 +00:00
parent d4d4a544db
commit 2405186d97
1 changed files with 6 additions and 7 deletions

View File

@ -40,7 +40,6 @@ import org.gcube.common.storagehub.model.items.Item;
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InsufficientPrivilegesException;
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.ItemAlreadyExistException;
@ -449,10 +448,10 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
return;
}
WorkspaceItem item = null;
WorkspaceItem destinationItem = null;
try {
logger.debug("getWorkspaceItem destination id: "+destinationId+" from HL");
item = storageHubWrapper.getWorkspace().getItem(destinationId);
destinationItem = storageHubWrapper.getWorkspace().getItem(destinationId);
} catch (ItemNotFoundException | InternalErrorException e) {
logger.error("Error, no destination folder found", e);
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.FAILED, "An error occurred during upload: "+fileName+". No destination folder found", request.getSession());
@ -465,14 +464,14 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
return;
}
if (item.getType() != WorkspaceItemType.FOLDER && item.getType() != WorkspaceItemType.SHARED_FOLDER) {
logger.error("Error processing request in upload servlet: Wrong destination item");
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.FAILED, "An error occurred during upload: "+fileName+". Wrong destination item", request.getSession());
if (!destinationItem.isFolder()) {
logger.error("Error processing request in upload servlet: The destination is not a folder");
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.FAILED, "An error occurred during upload: "+fileName+". The destination is not a folder", request.getSession());
sendError(response, "Internal error: Wrong destination item");
return;
}
final WorkspaceFolder destinationFolder = (WorkspaceFolder) item;
final WorkspaceFolder destinationFolder = (WorkspaceFolder) destinationItem;
try {
//Removing path from fileName