diff options
author | Alexander Kurtakov | 2017-06-21 12:43:34 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-06-21 13:01:46 +0000 |
commit | 7f22c5b775e1e0ce90bbf3055fd99b974d1e7414 (patch) | |
tree | c720b93e0776396735899f32589feed349dea9d1 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository | |
parent | c14ec65184393b6cc1ecd976068b8bdd7938eec1 (diff) | |
download | rt.equinox.p2-7f22c5b775e1e0ce90bbf3055fd99b974d1e7414.tar.gz rt.equinox.p2-7f22c5b775e1e0ce90bbf3055fd99b974d1e7414.tar.xz rt.equinox.p2-7f22c5b775e1e0ce90bbf3055fd99b974d1e7414.zip |
Bug 518574 - Use StandardCharsets
Bump BREE to 1.8 for bundles that were too low to have StandardCharsets.
Change-Id: Iac9e9615c5179b970df893182f5f1c6e3dd4d574
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository')
2 files changed, 10 insertions, 14 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java index 12b52360d..ff324b672 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2008, 2010 EclipseSource and others. All rights reserved. This +* Copyright (c) 2008, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -10,10 +10,12 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.metadata.repository; -import java.io.*; +import java.io.File; +import java.io.PrintStream; import java.math.BigInteger; import java.net.URI; import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.*; @@ -584,13 +586,11 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { try { MessageDigest algorithm = MessageDigest.getInstance("MD5"); //$NON-NLS-1$ algorithm.reset(); - algorithm.update(message.getBytes("UTF-8")); //$NON-NLS-1$ + algorithm.update(message.getBytes(StandardCharsets.UTF_8)); byte[] digestBytes = algorithm.digest(); return new BigInteger(1, digestBytes); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java index 57ee1642d..0567c5051 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Sonatype, Inc. and others. + * Copyright (c) 2011, 2017 Sonatype, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,8 +21,7 @@ public class StandaloneSerializationTest extends TestCase { public void testNothingToWrite() { try { File f = File.createTempFile(getName(), "iu"); - OutputStream os; - os = new FileOutputStream(f); + OutputStream os = new FileOutputStream(f); new IUSerializer(os).write(Collections.EMPTY_LIST); os.close(); assertTrue(f.length() > 0); @@ -41,8 +40,7 @@ public class StandaloneSerializationTest extends TestCase { File f = null; try { f = File.createTempFile(getName(), "iu"); - OutputStream os; - os = new FileOutputStream(f); + OutputStream os = new FileOutputStream(f); new IUSerializer(os).write(Collections.EMPTY_LIST); os.close(); } catch (FileNotFoundException e) { @@ -56,8 +54,7 @@ public class StandaloneSerializationTest extends TestCase { //Read file written boolean exceptionRaised = false; try { - InputStream is; - is = new FileInputStream(f); + InputStream is = new FileInputStream(f); Collection<IInstallableUnit> ius = new IUDeserializer().read(is); assertEquals(0, ius.size()); is.close(); @@ -88,8 +85,7 @@ public class StandaloneSerializationTest extends TestCase { File f = null; try { f = File.createTempFile(getName(), "iu"); - OutputStream os; - os = new FileOutputStream(f); + OutputStream os = new FileOutputStream(f); new IUSerializer(os).write(ius); os.close(); } catch (FileNotFoundException e) { |