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 | |
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
17 files changed, 66 insertions, 66 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(); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java index df2d74745..c8aeba0e0 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java @@ -212,7 +212,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase destFile.delete(); } destFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( destFile, contents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( destFile, contents, Charset.defaultCharset() ); return destFile; } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java index 6df2ce9fe..eaf50730d 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java @@ -182,7 +182,7 @@ public abstract class AbstractRepositoryServletTestCase assertTrue( "File <" + actualFile.getAbsolutePath() + "> should be a file (not a dir/link/device/etc).", actualFile.isFile() ); - String actualContents = FileUtils.readFileToString( actualFile, Charset.forName( "UTF-8" ) ); + String actualContents = FileUtils.readFileToString( actualFile, Charset.defaultCharset() ); assertEquals( "File Contents of <" + actualFile.getAbsolutePath() + ">", expectedContents, actualContents ); } @@ -295,7 +295,7 @@ public abstract class AbstractRepositoryServletTestCase { File destFile = new File( repoRootManaged, path ); destFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( destFile, contents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( destFile, contents, Charset.defaultCharset() ); return destFile; } } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java index 3c3e372f5..ddd228364 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java @@ -44,7 +44,7 @@ public class RepositoryServletNoProxyMetadataTest File checksumFile = new File( repoRootInternal, commonsLangMetadata ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -63,7 +63,7 @@ public class RepositoryServletNoProxyMetadataTest File checksumFile = new File( repoRootInternal, commonsLangMetadata ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -82,7 +82,7 @@ public class RepositoryServletNoProxyMetadataTest File checksumFile = new File( repoRootInternal, commonsLangMetadata ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -102,7 +102,7 @@ public class RepositoryServletNoProxyMetadataTest File checksumFile = new File( repoRootInternal, assemblyPluginMetadata ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + assemblyPluginMetadata ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java index 46f831555..38403d28c 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java @@ -57,7 +57,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootInternal, commonsLangSha1 ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -74,7 +74,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootInternal, commonsLangSha1 ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -92,7 +92,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootInternal, commonsLangSha1 ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar.sha1" ); @@ -112,7 +112,7 @@ public class RepositoryServletNoProxyTest File metadataFile = new File( repoRootInternal, commonsLangMetadata ); metadataFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -131,7 +131,7 @@ public class RepositoryServletNoProxyTest File metadataFile = new File( repoRootInternal, commonsLangMetadata ); metadataFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -150,7 +150,7 @@ public class RepositoryServletNoProxyTest File metadataFile = new File( repoRootInternal, commonsLangMetadata ); metadataFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -169,7 +169,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -188,7 +188,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar" ); @@ -208,7 +208,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -227,7 +227,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" ); @@ -247,7 +247,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -266,7 +266,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1-20050821.023400-1.jar" ); @@ -289,7 +289,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootInternal, dualExtensionPath ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + dualExtensionPath ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -308,7 +308,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootInternal, dualExtensionPath ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + "org.project/distributions/example-presentation-3.2.zip" ); @@ -327,7 +327,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootLegacy, "commons-lang/jars/commons-lang-2.1.jar.sha1" ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangSha1 ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -344,7 +344,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootLegacy, commonsLangSha1 ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangSha1 ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -364,7 +364,7 @@ public class RepositoryServletNoProxyTest File metadataFile = new File( repoRootLegacy, commonsLangMetadata ); metadataFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -384,7 +384,7 @@ public class RepositoryServletNoProxyTest File metadataFile = new File( repoRootLegacy, commonsLangMetadata ); metadataFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -403,7 +403,7 @@ public class RepositoryServletNoProxyTest File metadataFile = new File( repoRootLegacy, commonsLangMetadata ); metadataFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -422,7 +422,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootLegacy, "commons-lang/jars/commons-lang-2.1.jar" ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -441,7 +441,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootLegacy, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -460,7 +460,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootLegacy, "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -479,7 +479,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootLegacy, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -499,7 +499,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootLegacy, "commons-lang/jars/" + filename ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -518,7 +518,7 @@ public class RepositoryServletNoProxyTest File artifactFile = new File( repoRootLegacy, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -540,7 +540,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootLegacy, "org.project/distributions/example-presentation-3.2.xml.zip" ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + dualExtensionPath ); WebResponse response = getServletUnitClient().getResponse( request ); @@ -559,7 +559,7 @@ public class RepositoryServletNoProxyTest File checksumFile = new File( repoRootLegacy, dualExtensionPath ); checksumFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + dualExtensionPath ); WebResponse response = getServletUnitClient().getResponse( request ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java index 9e28c7b67..0171effeb 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java @@ -149,7 +149,7 @@ public class RepositoryServletRepositoryGroupTest File dummyInternalResourceFile = new File( repoRootFirst, resourceName ); dummyInternalResourceFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( dummyInternalResourceFile, "first", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( dummyInternalResourceFile, "first", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName ); @@ -170,7 +170,7 @@ public class RepositoryServletRepositoryGroupTest File dummyReleasesResourceFile = new File( repoRootLast, resourceName ); dummyReleasesResourceFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName ); @@ -243,7 +243,7 @@ public class RepositoryServletRepositoryGroupTest + "<metadata>\n<groupId>dummy</groupId>\n<artifactId>dummy-merged-metadata-resource</artifactId>\n" + "<versioning>\n<latest>1.0</latest>\n<release>1.0</release>\n<versions>\n<version>1.0</version>\n" + "<version>2.5</version>\n</versions>\n<lastUpdated>20080708095554</lastUpdated>\n</versioning>\n</metadata>", - Charset.forName( "UTF-8" ) ); + Charset.defaultCharset() ); //second metadata file resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml"; @@ -253,7 +253,7 @@ public class RepositoryServletRepositoryGroupTest + "<metadata><groupId>dummy</groupId><artifactId>dummy-merged-metadata-resource</artifactId>" + "<versioning><latest>2.0</latest><release>2.0</release><versions><version>1.0</version>" + "<version>1.5</version><version>2.0</version></versions><lastUpdated>20080709095554</lastUpdated>" - + "</versioning></metadata>", Charset.forName( "UTF-8" ) ); + + "</versioning></metadata>", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/" @@ -274,11 +274,11 @@ public class RepositoryServletRepositoryGroupTest //check if the checksum files were generated File checksumFileSha1 = new File( repoRootFirst, resourceName + ".sha1" ); checksumFileSha1.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFileSha1, "3290853214d3687134", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFileSha1, "3290853214d3687134", Charset.defaultCharset() ); File checksumFileMd5 = new File( repoRootFirst, resourceName + ".md5" ); checksumFileMd5.getParentFile().mkdirs(); - FileUtils.writeStringToFile( checksumFileMd5, "98745897234eda12836423", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( checksumFileMd5, "98745897234eda12836423", Charset.defaultCharset() ); // request the sha1 checksum of the metadata request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/" @@ -308,13 +308,13 @@ public class RepositoryServletRepositoryGroupTest File dummyInternalResourceFile = new File( repoRootFirst, resourceName ); dummyInternalResourceFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( dummyInternalResourceFile, "first", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( dummyInternalResourceFile, "first", Charset.defaultCharset() ); resourceName = "dummy/dummy-artifact/2.0/dummy-artifact-2.0.txt"; File dummyReleasesResourceFile = new File( repoRootLast, resourceName ); dummyReleasesResourceFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/dummy-artifact/" ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java index 37f9761ec..c818b09db 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java @@ -409,7 +409,7 @@ public class RepositoryServletSecurityTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar ); InvocationContext ic = sc.newInvocation( request ); @@ -465,7 +465,7 @@ public class RepositoryServletSecurityTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar ); InvocationContext ic = sc.newInvocation( request ); @@ -503,7 +503,7 @@ public class RepositoryServletSecurityTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar ); InvocationContext ic = sc.newInvocation( request ); @@ -554,7 +554,7 @@ public class RepositoryServletSecurityTest File artifactFile = new File( repoRootInternal, commonsLangJar ); artifactFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.forName( "UTF-8" ) ); + FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset() ); WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar ); InvocationContext ic = sc.newInvocation( request ); |