fixing minor bug

This commit is contained in:
Francesco Mangiacrapa 2020-10-08 15:08:30 +02:00
parent fa15f81d77
commit 05e0026c10
3 changed files with 14 additions and 40 deletions

20
pom.xml
View File

@ -97,22 +97,22 @@
<scope>compile</scope>
</dependency>
<!-- END FWS -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<scope>compile</scope>
</dependency>
<!-- JSON PARSER -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>client-context-library</artifactId>

View File

@ -45,11 +45,10 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.thirdparty.json.JSONTokener;
/**
* The Class MetadataProfileBuilderUploadServlet.
*
@ -229,7 +228,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
removeListenersIfDone(session, listClientUploadKeys);
for (String clientUploadKey : listClientUploadKeys) {
String fileName = mapKeys.get(clientUploadKey);
WorkspaceUploaderItem workspaceUploader = createNewWorkspaceUploader(clientUploadKey,fileName);
WorkspaceUploaderItem workspaceUploader = createNewWorkspaceUploader(clientUploadKey,fileName, user.getUsername());
logger.debug("created "+workspaceUploader);
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.WAIT, "Uploading "+fileName+" at 0%", request.getSession());
}
@ -468,12 +467,12 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
* @param fileName the file name
* @return the workspace uploader item
*/
private WorkspaceUploaderItem createNewWorkspaceUploader(String clientUploadKey, String fileName){
private WorkspaceUploaderItem createNewWorkspaceUploader(String clientUploadKey, String fileName, String user){
//CLIENT UPLOAD IS THE KEY
WorkspaceUploaderItem workspaceUploader = new WorkspaceUploaderItem(clientUploadKey);
workspaceUploader.setClientUploadKey(clientUploadKey);
//Create File
WorkspaceUploadFile wsUploadFile = new WorkspaceUploadFile(fileName, null, null);
WorkspaceUploadFile wsUploadFile = new WorkspaceUploadFile(fileName, null, user);
workspaceUploader.setFile(wsUploadFile);
return workspaceUploader;
}

View File

@ -85,28 +85,6 @@ public final class UploadProgressInputStream extends FilterInputStream {
updateListeners(totalBytes, totalBytes);
}
/**
* Update listeners.
*
* @param bytesRead the bytes read
* @param totalBytes the total bytes
*/
/*private void updateListeners(final long bytesRead, final long totalBytes) throws IOException{
try{
for (ProgressListener listener : listeners)
listener.update(bytesRead, totalBytes, listeners.size());
}catch(UploadCanceledException e){
logger.warn("Update Listener thrown UploadCanceledException: closing stream..");
try {
close();
}catch (IOException e1) {
logger.warn("Close stream thrown this Exception, silent catch");
}
throw new IOException("Upload cancelled from Client");
}
}*/
/**
* Update listeners.
*
@ -117,8 +95,5 @@ public final class UploadProgressInputStream extends FilterInputStream {
for (ProgressListener listener : listeners)
listener.update(bytesRead, totalBytes, listeners.size());
//UploadCanceledException IS PROPAGATED HERE
}
}