Improved message in case of InsufficenPrivileges

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@142310 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-02-07 10:29:25 +00:00
parent d23603d024
commit b32c187dc6
1 changed files with 10 additions and 5 deletions

View File

@ -101,8 +101,7 @@ public class WorkspaceUploaderMng {
} catch (Exception e1) { } catch (Exception e1) {
logger.error("Error during WorkspaceUploaderItem session update: ",e1); logger.error("Error during WorkspaceUploaderItem session update: ",e1);
} }
} catch (InternalErrorException } catch (InternalErrorException | IOException e) {
| IOException e) {
logger.error("Error during upload: ",e); logger.error("Error during upload: ",e);
workspaceUploader.setStatusDescription("An error occurred server-side during upload: "+itemName+". "+e.getMessage() +". Try again"); workspaceUploader.setStatusDescription("An error occurred server-side during upload: "+itemName+". "+e.getMessage() +". Try again");
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED); workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
@ -112,10 +111,16 @@ public class WorkspaceUploaderMng {
logger.error("Error during WorkspaceUploaderItem session update: ",e1); logger.error("Error during WorkspaceUploaderItem session update: ",e1);
} }
} catch (InsufficientPrivilegesException| ItemAlreadyExistException | ItemNotFoundException | WrongItemTypeException | WorkspaceFolderNotFoundException | WrongDestinationException e) { } catch (InsufficientPrivilegesException | ItemAlreadyExistException | ItemNotFoundException | WrongItemTypeException | WorkspaceFolderNotFoundException | WrongDestinationException e) {
logger.error("Error during overwrite: ",e); logger.error("Error during file uploading: ",e);
workspaceUploader.setStatusDescription("An error occurred during upload: "+itemName+". "+e.getMessage());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED); workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
if (e instanceof InsufficientPrivilegesException){
String folderName = destinationFolder.getName();
workspaceUploader.setStatusDescription("You have not permission to upload in the folder: "+folderName);
}else{
workspaceUploader.setStatusDescription("An error occurred during upload: "+itemName+". "+e.getMessage());
}
try { try {
WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader); WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader);
} catch (Exception e1) { } catch (Exception e1) {