diff options
author | Olivier Lamy <olamy@apache.org> | 2014-04-17 10:46:06 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-04-17 10:46:06 +1000 |
commit | 2132965397ca7d93a66c2eea3dfce98ca377268d (patch) | |
tree | 7062be19f897e4664b78190f864b76b8a29cbd30 /archiva-modules/archiva-base | |
parent | 0a21a1167f0688c014b0f28b6af9cf5408a687ab (diff) | |
download | archiva-2132965397ca7d93a66c2eea3dfce98ca377268d.tar.gz archiva-2132965397ca7d93a66c2eea3dfce98ca377268d.zip |
more code simplification with 1.7 features
Diffstat (limited to 'archiva-modules/archiva-base')
2 files changed, 4 insertions, 27 deletions
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java index 3635408df..ba8bf2703 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java +++ b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java @@ -51,12 +51,12 @@ import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.inject.Inject; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; +import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.nio.charset.Charset; +import java.nio.file.Files; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -393,24 +393,13 @@ public class LegacyToDefaultConverter private Metadata readMetadata( File file ) throws ArtifactConversionException { - Metadata metadata; MetadataXpp3Reader reader = new MetadataXpp3Reader(); - try (FileReader fileReader = new FileReader( file )) + try (Reader fileReader = Files.newBufferedReader( file.toPath(), Charset.defaultCharset() )) { return reader.read( fileReader ); } - catch ( FileNotFoundException e ) - { - throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ), - e ); //$NON-NLS-1$ - } - catch ( IOException e ) - { - throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ), - e ); //$NON-NLS-1$ - } - catch ( XmlPullParserException e ) + catch ( IOException | XmlPullParserException e ) { throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ), e ); //$NON-NLS-1$ diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/ValidateChecksumConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/ValidateChecksumConsumer.java index 0a8f22ffc..07f108c30 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/ValidateChecksumConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/ValidateChecksumConsumer.java @@ -60,24 +60,12 @@ public class ValidateChecksumConsumer private static final String CHECKSUM_IO_ERROR = "checksum-io-error"; - /** - * default-value="validate-checksums" - */ private String id = "validate-checksums"; - /** - * default-value="Validate checksums against file." - */ private String description = "Validate checksums against file."; - /** - * - */ private ChecksumFile checksum; - /** - * - */ private List<Digester> allDigesters; @Inject |