moved to method deleteOnExit for temporary preview images
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@134214 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f56a37ee15
commit
6e23bf8fbf
|
@ -245,10 +245,12 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
||||||
//generate the random dir
|
//generate the random dir
|
||||||
File theRandomDir = new File(UPLOAD_LOCATION_LOCAL + File.separator + UUID.randomUUID().toString());
|
File theRandomDir = new File(UPLOAD_LOCATION_LOCAL + File.separator + UUID.randomUUID().toString());
|
||||||
theRandomDir.mkdir();
|
theRandomDir.mkdir();
|
||||||
|
theRandomDir.deleteOnExit();
|
||||||
_log.debug("Created temp upload directory in: " + theRandomDir);
|
_log.debug("Created temp upload directory in: " + theRandomDir);
|
||||||
|
|
||||||
// generate a random file name and create it under the randomDir
|
// generate a random file name and create it under the randomDir
|
||||||
File file = new File(theRandomDir, UUID.randomUUID().toString().substring(0, 10));
|
File file = new File(theRandomDir, UUID.randomUUID().toString().substring(0, 10));
|
||||||
|
file.deleteOnExit();
|
||||||
|
|
||||||
//Get the inputstream and copy there
|
//Get the inputstream and copy there
|
||||||
URL url = new URL(urlThumbnail);
|
URL url = new URL(urlThumbnail);
|
||||||
|
@ -289,12 +291,6 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete file and folder
|
|
||||||
File parentDir = localFile.getParentFile();
|
|
||||||
localFile.delete();
|
|
||||||
parentDir.delete();
|
|
||||||
|
|
||||||
return thumbnailUrlFTP;
|
return thumbnailUrlFTP;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
_log.error("Error while saving thumbnail on ftp", e);
|
_log.error("Error while saving thumbnail on ftp", e);
|
||||||
|
|
Loading…
Reference in New Issue