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:
parent
d4d4a544db
commit
2405186d97
|
@ -40,7 +40,6 @@ import org.gcube.common.storagehub.model.items.Item;
|
||||||
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
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.InsufficientPrivilegesException;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.ItemAlreadyExistException;
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.ItemAlreadyExistException;
|
||||||
|
@ -449,10 +448,10 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceItem item = null;
|
WorkspaceItem destinationItem = null;
|
||||||
try {
|
try {
|
||||||
logger.debug("getWorkspaceItem destination id: "+destinationId+" from HL");
|
logger.debug("getWorkspaceItem destination id: "+destinationId+" from HL");
|
||||||
item = storageHubWrapper.getWorkspace().getItem(destinationId);
|
destinationItem = storageHubWrapper.getWorkspace().getItem(destinationId);
|
||||||
} catch (ItemNotFoundException | InternalErrorException e) {
|
} catch (ItemNotFoundException | InternalErrorException e) {
|
||||||
logger.error("Error, no destination folder found", 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());
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getType() != WorkspaceItemType.FOLDER && item.getType() != WorkspaceItemType.SHARED_FOLDER) {
|
if (!destinationItem.isFolder()) {
|
||||||
logger.error("Error processing request in upload servlet: Wrong destination item");
|
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+". Wrong destination item", request.getSession());
|
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");
|
sendError(response, "Internal error: Wrong destination item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorkspaceFolder destinationFolder = (WorkspaceFolder) item;
|
final WorkspaceFolder destinationFolder = (WorkspaceFolder) destinationItem;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Removing path from fileName
|
//Removing path from fileName
|
||||||
|
|
Loading…
Reference in New Issue