diff options
author | Olivier Lamy <olamy@apache.org> | 2014-04-16 17:36:01 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-04-16 17:36:01 +1000 |
commit | 767e00c182085b193c9f2481a815e90c5c054095 (patch) | |
tree | 9abbd1c82b82718acf3373bb719d3f38f7667ee5 /archiva-modules/archiva-base/archiva-proxy | |
parent | 67985e0486f4c0d4fb65ca0859201d70e91703b5 (diff) | |
download | archiva-767e00c182085b193c9f2481a815e90c5c054095.tar.gz archiva-767e00c182085b193c9f2481a815e90c5c054095.zip |
use Files from java.nio
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy')
-rw-r--r-- | archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java index c4b8b0f11..151dd61ea 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -19,7 +19,6 @@ package org.apache.archiva.proxy; * under the License. */ -import com.google.common.io.Files; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.NetworkProxy; import org.apache.archiva.admin.model.beans.ProxyConnectorRuleType; @@ -87,6 +86,7 @@ import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -99,7 +99,7 @@ import java.util.concurrent.ConcurrentHashMap; /** * DefaultRepositoryProxyConnectors - * + * <p/> * TODO exception handling needs work - "not modified" is not really an exceptional case, and it has more layers than * your average brown onion */ @@ -148,7 +148,7 @@ public class DefaultRepositoryProxyConnectors private NetworkProxyAdmin networkProxyAdmin; @Inject - @Named( value = "fileLockManager#default" ) + @Named(value = "fileLockManager#default") private FileLockManager fileLockManager; @PostConstruct @@ -283,8 +283,7 @@ public class DefaultRepositoryProxyConnectors String targetRepository, List<ProxyConnectorRuleConfiguration> all ) { - List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations = - new ArrayList<>(); + List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations = new ArrayList<>(); for ( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration : all ) { @@ -430,7 +429,8 @@ public class DefaultRepositoryProxyConnectors log.debug( MarkerFactory.getDetachedMarker( "transfer.error" ), "Transfer error from repository \"" + targetRepository.getRepository().getId() + "\" for resource " + path + ", continuing to next repository. Error message: {}", - e.getMessage(), e ); + e.getMessage(), e + ); } catch ( RepositoryAdminException e ) { @@ -1067,7 +1067,15 @@ public class DefaultRepositoryProxyConnectors */ private File createWorkingDirectory( ManagedRepositoryContent repository ) { - return Files.createTempDir(); + try + { + return Files.createTempDirectory( "temp" ).toFile(); + } + catch ( IOException e ) + { + throw new RuntimeException( e.getMessage(), e ); + } + } /** @@ -1120,10 +1128,12 @@ public class DefaultRepositoryProxyConnectors FileUtils.deleteQuietly( temp ); } } - } catch( FileLockException e) + } + catch ( FileLockException e ) { throw new ProxyException( e.getMessage(), e ); - } catch (FileLockTimeoutException e) + } + catch ( FileLockTimeoutException e ) { throw new ProxyException( e.getMessage(), e ); } |