fixed bug:

changed position between setId and setStatus to the trade safe 

refactor on listner class

updated pom version at 1.0.1

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@120199 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-11-05 17:00:44 +00:00
parent 4cb3b6d3e0
commit b5d0bd78ab
4 changed files with 14 additions and 14 deletions

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-uploader</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
<name>Workspace Uploader Widget</name>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}</connection>

View File

@ -718,13 +718,13 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
}
} catch (WrongDestinationException e) {
logger.error("Error creating elements", e);
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred in the upload. Wrong Destination");
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
sendError(response, "Internal error: Wrong Destination");
} catch (WorkspaceFolderNotFoundException e) {
logger.error("Error creating elements", e);
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred in the upload. Workspace Folder Not Found");
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
sendError(response, "Internal error: Workspace Folder Not Found");
}finally{
try {
@ -780,13 +780,13 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
} catch (WrongDestinationException e) {
logger.error("Error creating elements", e);
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred in the upload. Wrong Destination");
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
sendError(response, "Internal error: Wrong Destination");
} catch (WorkspaceFolderNotFoundException e) {
logger.error("Error creating elements", e);
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred in the upload. Workspace Folder Not Found");
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
sendError(response, "Internal error: Workspace Folder Not Found");
}finally{
try {

View File

@ -49,7 +49,7 @@ public class WorkspaceUploaderServiceImpl extends RemoteServiceServlet implement
else
progress = "upload progress is null or last event is null";
logger.info("returning uploader: "+uploader.getClientUploadKey() +" status: "+uploader.getUploadStatus() +", progress: "+progress);
logger.info("returning uploader: "+uploader.getClientUploadKey() +" status: "+uploader.getUploadStatus() +", file: "+uploader.getFile().toString() +", progress: "+progress);
return uploader;
}

View File

@ -82,14 +82,14 @@ public class WorkspaceUploaderMng {
if(createdItem!=null){
WorkspaceUploadServletStream.printElapsedTime(startTime);
logger.debug("HL file: "+createdItem.getName() + " with id: "+createdItem.getId() + " uploaded correctly in "+destinationFolder.getPath());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.COMPLETED);
workspaceUploader.setStatusDescription("File \""+createdItem.getName()+"\" uploaded correctly in "+destinationFolder.getPath());
workspaceUploader.getFile().setItemId(createdItem.getId()); //SET HL ID
workspaceUploader.getFile().setParentId(createdItem.getParent().getId());//SET PARENT ID
workspaceUploader.setStatusDescription("File \""+createdItem.getName()+"\" uploaded correctly in "+destinationFolder.getPath());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.COMPLETED);
WorkspaceUploadServletStream.notifyUploadInSharedFolder(httpSession, wa, createdItem.getId(), createdItem.getParent().getId(), isOvewrite);
}else{
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred during upload: \""+itemName + "\". Try again");
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
}
try {
WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader);
@ -100,8 +100,8 @@ public class WorkspaceUploaderMng {
| ItemAlreadyExistException | InternalErrorException
| IOException e) {
logger.error("Error during upload: ",e);
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred during upload: "+itemName+". "+e.getMessage());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
try {
WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader);
} catch (Exception e1) {
@ -109,8 +109,8 @@ public class WorkspaceUploaderMng {
}
} catch (ItemNotFoundException | WrongItemTypeException | WorkspaceFolderNotFoundException | WrongDestinationException e) {
logger.error("Error during overwrite: ",e);
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred during upload: "+itemName+". "+e.getMessage());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
try {
WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader);
} catch (Exception e1) {
@ -149,9 +149,9 @@ public class WorkspaceUploaderMng {
UnzipUtil.unzip(destinationFolder, uploadFile, itemName);
logger.info("Archive "+itemName+ " imported correctly in "+destinationFolder.getPath());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.COMPLETED);
workspaceUploader.setStatusDescription("Archive "+itemName+ " imported correctly in "+destinationFolder.getPath());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.COMPLETED);
try {
WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader);
} catch (Exception e1) {
@ -159,8 +159,8 @@ public class WorkspaceUploaderMng {
}
} catch (InternalErrorException e) {
logger.error("Error during uploading: ",e);
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
workspaceUploader.setStatusDescription("An error occurred during upload: "+itemName+". "+e.getMessage());
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
try {
WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader);
} catch (Exception e1) {