本文整理了Java中org.apache.archiva.common.utils.FileUtils.deleteQuietly()
方法的一些代码示例,展示了FileUtils.deleteQuietly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.deleteQuietly()
方法的具体详情如下:
包路径:org.apache.archiva.common.utils.FileUtils
类名称:FileUtils
方法名:deleteQuietly
[英]Deletes the directory recursively and quietly.
[中]以递归方式安静地删除目录。
代码示例来源:origin: apache/archiva
@Override
public void deleteVersion( VersionedReference reference )
{
String path = toMetadataPath( reference );
Path projectPath = Paths.get( getRepoRoot(), path );
Path projectDir = projectPath.getParent();
if ( Files.exists(projectDir) && Files.isDirectory(projectDir) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( projectDir );
}
}
代码示例来源:origin: apache/archiva
private void createChecksumFile( String path, Digester digester )
throws DigesterException, IOException
{
Path checksumFile = Paths.get( path + digester.getFilenameExtension() );
if ( !Files.exists(checksumFile) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( checksumFile );
checksum.createChecksum( Paths.get( path ).toFile(), digester );
}
else if ( !Files.isRegularFile( checksumFile) )
{
log.error( "Checksum file is not a file." );
}
}
代码示例来源:origin: apache/archiva
@Override
public void deleteArtifact( ArtifactReference artifactReference )
{
String path = toPath( artifactReference );
Path filePath = Paths.get( getRepoRoot(), path );
if ( Files.exists(filePath) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( filePath );
}
Path filePathmd5 = Paths.get( getRepoRoot(), path + ".md5" );
if ( Files.exists(filePathmd5) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( filePathmd5 );
}
Path filePathsha1 = Paths.get( getRepoRoot(), path + ".sha1" );
if ( Files.exists(filePathsha1) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( filePathsha1 );
}
}
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteQuietly(fileToMove);
代码示例来源:origin: apache/archiva
private Path writeMergedMetadataToFile( ArchivaRepositoryMetadata mergedMetadata, String outputFilename )
throws RepositoryMetadataException, DigesterException, IOException
{
Path outputFile = Paths.get( outputFilename );
if ( Files.exists(outputFile) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( outputFile );
}
Files.createDirectories(outputFile.getParent());
RepositoryMetadataWriter.write( mergedMetadata, outputFile );
createChecksumFile( outputFilename, digestSha1 );
createChecksumFile( outputFilename, digestMd5 );
return outputFile;
}
代码示例来源:origin: apache/archiva
public static void write( ArchivaRepositoryMetadata metadata, Path outputFile )
throws RepositoryMetadataException
{
boolean thrown = false;
try (FileWriter writer = new FileWriter( outputFile.toFile() ))
{
write( metadata, writer );
writer.flush();
}
catch ( IOException e )
{
thrown = true;
throw new RepositoryMetadataException(
"Unable to write metadata file: " + outputFile.toAbsolutePath() + " - " + e.getMessage(), e );
}
finally
{
if ( thrown )
{
FileUtils.deleteQuietly( outputFile );
}
}
}
代码示例来源:origin: apache/archiva
FileUtils.deleteQuietly( file );
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteQuietly( temp );
代码示例来源:origin: apache/archiva
log.debug( "Upload failed: {}", msg );
org.apache.archiva.common.utils.FileUtils.deleteQuietly( localFile );
throw new DavException( HttpServletResponse.SC_BAD_REQUEST, msg );
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteQuietly( workingDirectory );
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteQuietly( workingDirectory );
代码示例来源:origin: apache/archiva
@Test
public void checkRemoteConnectivityEmptyRemote()
throws Exception
{
Path tmpDir = Files.createTempDirectory( "test" );
Server repoServer = buildStaticServer( tmpDir );
ServerConnector serverConnector = new ServerConnector( repoServer, new HttpConnectionFactory());
repoServer.addConnector( serverConnector );
repoServer.start();
RemoteRepositoriesService service = getRemoteRepositoriesService();
WebClient.client( service ).header( "Authorization", authorizationHeader );
try
{
int repoServerPort = serverConnector.getLocalPort();
RemoteRepository repo = getRemoteRepository();
repo.setUrl( "http://localhost:" + repoServerPort );
service.addRemoteRepository( repo );
assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isTrue();
}
finally
{
service.deleteRemoteRepository( "id-new" );
org.apache.archiva.common.utils.FileUtils.deleteQuietly( tmpDir );
repoServer.stop();
}
}
代码示例来源:origin: apache/archiva
FileUtils.deleteQuietly( indexBaseDir);
if (!Files.exists(indexBaseDir)) {
Files.createDirectories( indexBaseDir );
内容来源于网络,如有侵权,请联系作者删除!