diff options
author | Olivier Lamy <olamy@apache.org> | 2012-09-15 21:38:31 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-09-15 21:38:31 +0000 |
commit | 73509cab5c05663ca330ec4ea9b6f508c2921521 (patch) | |
tree | c8fad2eaa4ab9798ad5bac4104baae00b5da76f5 /archiva-modules/archiva-base | |
parent | 833d272ab4200f032d456a72e1e316ed64acd304 (diff) | |
download | archiva-73509cab5c05663ca330ec4ea9b6f508c2921521.tar.gz archiva-73509cab5c05663ca330ec4ea9b6f508c2921521.zip |
prefer Charset.defaultCharset() over a hardcoded charset
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1385188 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
11 files changed, 20 insertions, 20 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 c777b32a1..83a1f4cff 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 @@ -210,7 +210,7 @@ public class LegacyToDefaultConverter } // Even if the checksums for the POM are invalid we should still convert the POM - contents = FileUtils.readFileToString( file, Charset.forName( "UTF-8" ) ); + contents = FileUtils.readFileToString( file, Charset.defaultCharset() ); } catch ( IOException e ) { @@ -226,7 +226,7 @@ public class LegacyToDefaultConverter boolean matching = false; if ( !force && targetFile.exists() ) { - String targetContents = FileUtils.readFileToString( targetFile, Charset.forName( "UTF-8" ) ); + String targetContents = FileUtils.readFileToString( targetFile, Charset.defaultCharset() ); matching = targetContents.equals( contents ); } if ( force || !matching ) @@ -327,7 +327,7 @@ public class LegacyToDefaultConverter File checksumFile = new File( file.getParentFile(), fileName ); if ( checksumFile.exists() ) { - String checksum = FileUtils.readFileToString( checksumFile, Charset.forName( "UTF-8" ) ); + String checksum = FileUtils.readFileToString( checksumFile, Charset.defaultCharset() ); try { digester.verify( file, checksum ); diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java index f6544f655..2ab82c6a9 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java +++ b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java @@ -985,9 +985,9 @@ public class LegacyToDefaultConverterTest throws IOException { String expectedContent = normalizeString( - org.apache.commons.io.FileUtils.readFileToString( expectedPomFile, Charset.forName( "UTF-8" ) ) ); + org.apache.commons.io.FileUtils.readFileToString( expectedPomFile, Charset.defaultCharset() ) ); String targetContent = - normalizeString( org.apache.commons.io.FileUtils.readFileToString( pomFile, Charset.forName( "UTF-8" ) ) ); + normalizeString( org.apache.commons.io.FileUtils.readFileToString( pomFile, Charset.defaultCharset() ) ); assertEquals( "Check file match between " + expectedPomFile + " and " + pomFile, expectedContent, targetContent ); } diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java index 1f45d600f..d491f1dd3 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java @@ -695,7 +695,7 @@ public class ArchivaConfigurationTest FileUtils.copyFile( getTestFile( "src/test/conf/escape-cron-expressions.xml" ), baseFile ); userFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.defaultCharset() ); final ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-cron-expressions" ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java index 6ff8b5108..6f672dee1 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java @@ -135,7 +135,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest // check if metadata file was updated File artifactMetadataFile = new File( projectRoot + "/maven-metadata.xml" ); - String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.forName( "UTF-8" ) ); + String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.defaultCharset() ); String expectedVersions = "<expected><versions><version>2.2</version>" + "<version>2.3</version></versions></expected>"; @@ -270,7 +270,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest // check if metadata file was not updated (because nothing was removed) File artifactMetadataFile = new File( projectRoot + "/maven-metadata.xml" ); - String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.forName( "UTF-8" ) ); + String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.defaultCharset() ); String expectedVersions = "<expected><versions><version>2.0.3-SNAPSHOT</version>" + "<version>2.0.4-SNAPSHOT</version></versions></expected>"; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java index b99b46a7c..30f4df99c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java @@ -323,7 +323,7 @@ public class RepositoryPurgeConsumerTest // check if metadata file wasn't updated File artifactMetadataFile = new File( projectRoot + "/maven-metadata.xml" ); - String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.forName( "UTF-8" ) ); + String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.defaultCharset() ); String expectedVersions = "<expected><versions><version>2.3-SNAPSHOT</version></versions></expected>"; @@ -368,7 +368,7 @@ public class RepositoryPurgeConsumerTest // check if metadata file was updated File artifactMetadataFile = new File( projectRoot + "/maven-metadata.xml" ); - String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.forName( "UTF-8" ) ); + String metadataXml = FileUtils.readFileToString( artifactMetadataFile, Charset.defaultCharset() ); String expectedVersions = "<expected><versions><version>2.2</version>" + "<version>2.3</version></versions></expected>"; diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index c0762767f..fb2ec922b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -330,9 +330,9 @@ public abstract class AbstractProxyTestCase assertEquals( "Check file path matches.", expectedFile.getAbsolutePath(), actualFile.getAbsolutePath() ); String expectedContents = - org.apache.commons.io.FileUtils.readFileToString( sourceFile, Charset.forName( "UTF-8" ) ); + org.apache.commons.io.FileUtils.readFileToString( sourceFile, Charset.defaultCharset() ); String actualContents = - org.apache.commons.io.FileUtils.readFileToString( actualFile, Charset.forName( "UTF-8" ) ); + org.apache.commons.io.FileUtils.readFileToString( actualFile, Charset.defaultCharset() ); assertEquals( "Check file contents.", expectedContents, actualContents ); } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index 37673bd72..f3264febe 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -208,8 +208,8 @@ public class HttpProxyTransferTest downloadedFile.getCanonicalPath() ); assertEquals( "Check file path matches.", expectedFile.getAbsolutePath(), downloadedFile.getAbsolutePath() ); - String expectedContents = FileUtils.readFileToString( sourceFile, Charset.forName( "UTF-8" ) ); - String actualContents = FileUtils.readFileToString( downloadedFile, Charset.forName( "UTF-8") ); + String expectedContents = FileUtils.readFileToString( sourceFile, Charset.defaultCharset() ); + String actualContents = FileUtils.readFileToString( downloadedFile, Charset.defaultCharset() ); assertEquals( "Check file contents.", expectedContents, actualContents ); assertNull( System.getProperty( "http.proxyHost" ) ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java index 84bce0d07..ed739f186 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java @@ -328,8 +328,8 @@ public class ManagedDefaultTransferTest assertNoTempFiles( expectedFile ); // TODO: is this check even needed if it passes above? - String actualContents = FileUtils.readFileToString( downloadedFile, Charset.forName( "UTF-8" ) ); - String badContents = FileUtils.readFileToString( proxied2File, Charset.forName( "UTF-8" ) ); + String actualContents = FileUtils.readFileToString( downloadedFile, Charset.defaultCharset() ); + String badContents = FileUtils.readFileToString( proxied2File, Charset.defaultCharset() ); assertFalse( "Downloaded file contents should not be that of proxy 2", StringUtils.equals( actualContents, badContents ) ); } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java index 60b64c541..dea5ad5b3 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java @@ -247,7 +247,7 @@ public class WagonDelegate else { FileUtils.writeStringToFile( new File( destination.getAbsolutePath() ), contentToGet, - Charset.forName( "UTF-8" ) ); + Charset.defaultCharset() ); } } catch ( IOException e ) diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java index 5ffd916eb..e33f2daac 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java @@ -388,7 +388,7 @@ public class MetadataToolsTest throws LayoutException, IOException, SAXException, ParserConfigurationException { File metadataFile = new File( repository.getRepoRoot(), tools.toPath( reference ) ); - String actualMetadata = FileUtils.readFileToString( metadataFile, Charset.forName( "UTF-8" ) ); + String actualMetadata = FileUtils.readFileToString( metadataFile, Charset.defaultCharset() ); DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) ); if ( !detailedDiff.similar() ) @@ -403,7 +403,7 @@ public class MetadataToolsTest throws LayoutException, IOException, SAXException, ParserConfigurationException { File metadataFile = new File( repository.getRepoRoot(), tools.toPath( reference ) ); - String actualMetadata = FileUtils.readFileToString( metadataFile, Charset.forName( "UTF-8" ) ); + String actualMetadata = FileUtils.readFileToString( metadataFile, Charset.defaultCharset() ); DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) ); if ( !detailedDiff.similar() ) diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java index 65b267b7f..51b9062d8 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java @@ -45,7 +45,7 @@ public class RepositoryMetadataWriterTest { File defaultRepoDir = new File( "src/test/repositories/default-repository" ); File expectedFile = new File( defaultRepoDir, "org/apache/maven/shared/maven-downloader/maven-metadata.xml" ); - String expectedContent = FileUtils.readFileToString( expectedFile, Charset.forName( "UTF-8" ) ); + String expectedContent = FileUtils.readFileToString( expectedFile, Charset.defaultCharset() ); ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata(); |