diff options
author | Eric Barboni <skygo@apache.org> | 2014-04-18 01:46:55 +0200 |
---|---|---|
committer | Eric Barboni <skygo@apache.org> | 2014-04-18 01:46:55 +0200 |
commit | a7c6ebb10e533634d4cdd0c2baa2034979524f85 (patch) | |
tree | f068809f8284d8a788b37d2c53d75427ccca43de /archiva-modules/plugins | |
parent | fe7e671f3bb075e22572da95cf2eddc100e0eb73 (diff) | |
download | archiva-a7c6ebb10e533634d4cdd0c2baa2034979524f85.tar.gz archiva-a7c6ebb10e533634d4cdd0c2baa2034979524f85.zip |
jdk 7 (multicatch) for-loop
remove unused package, reduce annotations (value= or locations=)
move javadoc from Maven2RepsotirotyStorage to RepositoryStorage
Diffstat (limited to 'archiva-modules/plugins')
5 files changed, 24 insertions, 59 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java index 53e801b52..6acf622e1 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java @@ -92,7 +92,7 @@ public class Maven3DependencyTreeBuilder private PlexusSisuBridge plexusSisuBridge; @Inject - @Named(value = "repositoryPathTranslator#maven2") + @Named( "repositoryPathTranslator#maven2" ) private RepositoryPathTranslator pathTranslator; @Inject diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index 0543c334d..6db2b79ab 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -84,7 +84,6 @@ import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.FilenameFilter; import java.io.IOException; import java.io.Reader; @@ -130,7 +129,7 @@ public class Maven2RepositoryStorage private NetworkProxyAdmin networkProxyAdmin; @Inject - @Named( value = "repositoryPathTranslator#maven2" ) + @Named( "repositoryPathTranslator#maven2" ) private RepositoryPathTranslator pathTranslator; @Inject @@ -140,7 +139,7 @@ public class Maven2RepositoryStorage private ApplicationContext applicationContext; @Inject - @Named( value = "pathParser#default" ) + @Named( "pathParser#default" ) private PathParser pathParser; private static final String METADATA_FILENAME_START = "maven-metadata"; @@ -649,14 +648,6 @@ public class Maven2RepositoryStorage return metadata; } - /** - * A relocation capable client will request the POM prior to the artifact, and will then read meta-data and do - * client side relocation. A simplier client (like maven 1) will only request the artifact and not use the - * metadatas. - * <p> - * For such clients, archiva does server-side relocation by reading itself the <relocation> element in - * metadatas and serving the expected artifact. - */ @Override public void applyServerSideRelocation( ManagedRepositoryContent managedRepository, ArtifactReference artifact ) throws ProxyDownloadException diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index 99340f3e9..0113513fb 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -403,12 +403,7 @@ public class RepositoryModelResolver } connected = true; } - catch ( ConnectionException e ) - { - log.error( "Could not connect to {}:{} ", remoteRepository.getName(), e.getMessage() ); - connected = false; - } - catch ( AuthenticationException e ) + catch ( ConnectionException | AuthenticationException e ) { log.error( "Could not connect to {}:{} ", remoteRepository.getName(), e.getMessage() ); connected = false; diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java index e40292d7f..6c7f239c8 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java @@ -56,7 +56,7 @@ public abstract class AbstractLegacyRepositoryContent * */ @Inject - @Named( value = "pathParser#legacy" ) + @Named( "pathParser#legacy" ) private PathParser legacyPathParser; public ArtifactReference toArtifactReference( String path ) diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java index 930855ea0..aa4ca8a5a 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java @@ -54,7 +54,7 @@ public class ManagedDefaultRepositoryContent implements ManagedRepositoryContent { @Inject - @Named (value = "fileTypes") + @Named ( "fileTypes" ) private FileTypes filetypes; private ManagedRepository repository; @@ -182,20 +182,17 @@ public class ManagedDefaultRepositoryContent "Unable to get related artifacts using a non-directory: " + repoDir.getAbsolutePath() ); } - Set<ArtifactReference> foundArtifacts = new HashSet<ArtifactReference>(); + Set<ArtifactReference> foundArtifacts = new HashSet<>(); // First gather up the versions found as artifacts in the managed repository. File repoFiles[] = repoDir.listFiles(); - for ( int i = 0; i < repoFiles.length; i++ ) + for (File repoFile : repoFiles) { - if ( repoFiles[i].isDirectory() ) - { + if (repoFile.isDirectory()) { // Skip it. it's a directory. continue; } - - String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i] ); - + String relativePath = PathUtil.getRelative(repository.getLocation(), repoFile); if ( filetypes.matchesArtifactPattern( relativePath ) ) { try @@ -204,7 +201,7 @@ public class ManagedDefaultRepositoryContent // Test for related, groupId / artifactId / version must match. if ( artifact.getGroupId().equals( reference.getGroupId() ) && artifact.getArtifactId().equals( - reference.getArtifactId() ) && artifact.getVersion().equals( reference.getVersion() ) ) + reference.getArtifactId() ) && artifact.getVersion().equals( reference.getVersion() ) ) { foundArtifacts.add( artifact ); } @@ -265,24 +262,21 @@ public class ManagedDefaultRepositoryContent "Unable to get Versions on a non-directory: " + repoDir.getAbsolutePath() ); } - Set<String> foundVersions = new HashSet<String>(); + Set<String> foundVersions = new HashSet<>(); VersionedReference versionRef = new VersionedReference(); versionRef.setGroupId( reference.getGroupId() ); versionRef.setArtifactId( reference.getArtifactId() ); File repoFiles[] = repoDir.listFiles(); - for ( int i = 0; i < repoFiles.length; i++ ) + for (File repoFile : repoFiles) { - if ( !repoFiles[i].isDirectory() ) - { + if (!repoFile.isDirectory()) { // Skip it. not a directory. continue; } - // Test if dir has an artifact, which proves to us that it is a valid version directory. - String version = repoFiles[i].getName(); + String version = repoFile.getName(); versionRef.setVersion( version ); - if ( hasArtifact( versionRef ) ) { // Found an artifact, must be a valid version. @@ -319,26 +313,22 @@ public class ManagedDefaultRepositoryContent "Unable to get versions on a non-directory: " + repoDir.getAbsolutePath() ); } - Set<String> foundVersions = new HashSet<String>(); + Set<String> foundVersions = new HashSet<>(); // First gather up the versions found as artifacts in the managed repository. File repoFiles[] = repoDir.listFiles(); - for ( int i = 0; i < repoFiles.length; i++ ) + for (File repoFile : repoFiles) { - if ( repoFiles[i].isDirectory() ) - { + if (repoFile.isDirectory()) { // Skip it. it's a directory. continue; } - - String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i] ); - + String relativePath = PathUtil.getRelative(repository.getLocation(), repoFile); if ( filetypes.matchesDefaultExclusions( relativePath ) ) { // Skip it, it's metadata or similar continue; } - if ( filetypes.matchesArtifactPattern( relativePath ) ) { try @@ -372,11 +362,7 @@ public class ManagedDefaultRepositoryContent Set<String> versions = getVersions( reference ); return !versions.isEmpty(); } - catch ( ContentNotFoundException e ) - { - return false; - } - catch ( LayoutException e ) + catch ( ContentNotFoundException | LayoutException e ) { return false; } @@ -389,11 +375,7 @@ public class ManagedDefaultRepositoryContent { return ( getFirstArtifact( reference ) != null ); } - catch ( IOException e ) - { - return false; - } - catch ( LayoutException e ) + catch ( IOException | LayoutException e ) { return false; } @@ -470,16 +452,13 @@ public class ManagedDefaultRepositoryContent } File repoFiles[] = repoDir.listFiles(); - for ( int i = 0; i < repoFiles.length; i++ ) + for (File repoFile : repoFiles) { - if ( repoFiles[i].isDirectory() ) - { + if (repoFile.isDirectory()) { // Skip it. it's a directory. continue; } - - String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i] ); - + String relativePath = PathUtil.getRelative(repository.getLocation(), repoFile); if ( filetypes.matchesArtifactPattern( relativePath ) ) { ArtifactReference artifact = toArtifactReference( relativePath ); |