take care about using full file path on delete

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1308259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-04-02 07:21:06 +00:00
parent c3ee919adc
commit 2b730d9a8d
1 changed files with 3 additions and 2 deletions

View File

@ -180,7 +180,8 @@ public class DefaultFileUploadService
{ {
File file = new File( SystemUtils.getJavaIoTmpDir(), fileName ); File file = new File( SystemUtils.getJavaIoTmpDir(), fileName );
log.debug( "delete file:{},exists:{}", file.getPath(), file.exists() ); log.debug( "delete file:{},exists:{}", file.getPath(), file.exists() );
boolean removed = getSessionFileMetadatas().remove( new FileMetadata( fileName ) ); boolean removed = getSessionFileMetadatas().remove(
new FileMetadata( SystemUtils.getJavaIoTmpDir().getPath() + "/" + fileName ) );
if ( file.exists() ) if ( file.exists() )
{ {
return file.delete(); return file.delete();
@ -194,7 +195,7 @@ public class DefaultFileUploadService
List<FileMetadata> fileMetadatas = new ArrayList( getSessionFileMetadatas() ); List<FileMetadata> fileMetadatas = new ArrayList( getSessionFileMetadatas() );
for ( FileMetadata fileMetadata : fileMetadatas ) for ( FileMetadata fileMetadata : fileMetadatas )
{ {
deleteFile( fileMetadata.getServerFileName() ); deleteFile( new File( fileMetadata.getServerFileName() ).getName() );
} }
return Boolean.TRUE; return Boolean.TRUE;
} }