Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java19
-rw-r--r--bundles/org.eclipse.osgi.tests/.classpath2
-rw-r--r--bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ManifestElementTestCase.java22
5 files changed, 24 insertions, 27 deletions
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
index 72c08451a..c740ff2b4 100644
--- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
+++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -19,6 +19,7 @@ import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.*;
+import java.nio.charset.StandardCharsets;
import java.security.*;
import java.util.*;
import java.util.zip.ZipEntry;
@@ -781,12 +782,8 @@ public class Main {
}
if (!replaced)
return urlString;
- try {
- return new String(decodedBytes, 0, decodedLength, "UTF-8"); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- //use default encoding
- return new String(decodedBytes, 0, decodedLength);
- }
+
+ return new String(decodedBytes, 0, decodedLength, StandardCharsets.UTF_8);
}
/**
@@ -2637,7 +2634,7 @@ public class Main {
private void openLogFile() throws IOException {
computeLogFileLocation();
try {
- log = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile.getAbsolutePath(), true), "UTF-8")); //$NON-NLS-1$
+ log = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile.getAbsolutePath(), true), StandardCharsets.UTF_8));
} catch (IOException e) {
logFile = null;
throw e;
@@ -2645,11 +2642,7 @@ public class Main {
}
private BufferedWriter logForStream(OutputStream output) {
- try {
- return new BufferedWriter(new OutputStreamWriter(output, "UTF-8")); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- return new BufferedWriter(new OutputStreamWriter(output));
- }
+ return new BufferedWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8));
}
private void closeLogFile() throws IOException {
diff --git a/bundles/org.eclipse.osgi.tests/.classpath b/bundles/org.eclipse.osgi.tests/.classpath
index 5c88c4282..71ce99780 100644
--- a/bundles/org.eclipse.osgi.tests/.classpath
+++ b/bundles/org.eclipse.osgi.tests/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bundle_tests/test" path="bundles_src/test"/>
diff --git a/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs
index a5654cc0a..c69c78f2d 100644
--- a/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs
@@ -13,9 +13,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -114,7 +114,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF
index d6f676ee1..e3d6680d1 100644
--- a/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@ Bundle-Activator: org.eclipse.osgi.tests.OSGiTestsActivator
Import-Package: org.osgi.service.event; resolution:="optional"
Export-Package: org.eclipse.osgi.tests.bundles,
org.eclipse.osgi.tests.appadmin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
DynamicImport-Package: ext.framework.b
Eclipse-BundleShape: dir
Automatic-Module-Name: org.eclipse.osgi.tests
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ManifestElementTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ManifestElementTestCase.java
index 559673d70..57c90025d 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ManifestElementTestCase.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ManifestElementTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -11,8 +11,12 @@
package org.eclipse.osgi.tests.util;
-import java.io.*;
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
import junit.framework.TestCase;
import org.eclipse.osgi.util.ManifestElement;
import org.junit.Assert;
@@ -68,29 +72,29 @@ public class ManifestElementTestCase extends TestCase {
"" //
);
- public void testManifestWithCR() throws UnsupportedEncodingException, IOException, BundleException {
+ public void testManifestWithCR() throws IOException, BundleException {
doManifestTest("\r");
}
- public void testManifestWithLF() throws UnsupportedEncodingException, IOException, BundleException {
+ public void testManifestWithLF() throws IOException, BundleException {
doManifestTest("\n");
}
- public void testManifestWithCRLF() throws UnsupportedEncodingException, IOException, BundleException {
+ public void testManifestWithCRLF() throws IOException, BundleException {
doManifestTest("\r\n");
}
- private void doManifestTest(String newLine) throws UnsupportedEncodingException, IOException, BundleException {
+ private void doManifestTest(String newLine) throws IOException, BundleException {
Map<String, String> manifest = getManifest(TEST_MANIFEST, newLine);
Assert.assertEquals("Wrong Bundle-SymbolicName.", "test.bsn", manifest.get(Constants.BUNDLE_SYMBOLICNAME));
Assert.assertEquals("Wrong Import-Package.", "test1,test2,test3", manifest.get(Constants.IMPORT_PACKAGE));
}
- private Map<String, String> getManifest(List<String> manifestLines, String newLine) throws UnsupportedEncodingException, IOException, BundleException {
+ private Map<String, String> getManifest(List<String> manifestLines, String newLine) throws IOException, BundleException {
StringBuilder manifestText = new StringBuilder();
for (String line : manifestLines) {
manifestText.append(line).append(newLine);
}
- return ManifestElement.parseBundleManifest(new ByteArrayInputStream(manifestText.toString().getBytes("UTF8")), null);
+ return ManifestElement.parseBundleManifest(new ByteArrayInputStream(manifestText.toString().getBytes(StandardCharsets.UTF_8)), null);
}
}

Back to the top