Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-05-08 10:59:48 +0000
committerKarsten Thoms2018-05-09 09:59:36 +0000
commit1e7a29e071953ebb2101ad3b6c582b560b49845d (patch)
treed030972df65f98ab09bf7c71f0bd50e001a95314
parent3d920a7a364fdc3fa02da2c12f056ca4375525ce (diff)
downloadeclipse.platform.debug-1e7a29e071953ebb2101ad3b6c582b560b49845d.tar.gz
eclipse.platform.debug-1e7a29e071953ebb2101ad3b6c582b560b49845d.tar.xz
eclipse.platform.debug-1e7a29e071953ebb2101ad3b6c582b560b49845d.zip
Bug 533788 - Use StandardCharsetsI20180509-0800
Another bunch of such changes. Change-Id: I4012772607b8f7c165156b8d03fbd5bcbee4b581 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java3
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java5
6 files changed, 15 insertions, 22 deletions
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
index 8be6f7c3b..c6b8a5007 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 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
@@ -15,6 +15,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -278,7 +279,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
}
Element root= null;
try {
- ByteArrayInputStream stream = new ByteArrayInputStream(variablesString.getBytes("UTF-8")); //$NON-NLS-1$
+ ByteArrayInputStream stream = new ByteArrayInputStream(variablesString.getBytes(StandardCharsets.UTF_8));
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
root = parser.parse(stream).getDocumentElement();
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index c46f4bab3..fb06df664 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -16,6 +16,7 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -1223,7 +1224,7 @@ public class DebugPlugin extends Plugin {
try{
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
- stream = new ByteArrayInputStream(document.getBytes("UTF8")); //$NON-NLS-1$
+ stream = new ByteArrayInputStream(document.getBytes(StandardCharsets.UTF_8));
root = parser.parse(stream).getDocumentElement();
} catch (ParserConfigurationException e) {
abort("Unable to parse XML document.", e); //$NON-NLS-1$
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index fc732fd2c..11eed21d3 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -310,9 +310,8 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
BufferedOutputStream stream = null;
try {
stream = new BufferedOutputStream(file.openOutputStream(EFS.NONE, null));
- stream.write(xml.getBytes("UTF8")); //$NON-NLS-1$
- }
- finally {
+ stream.write(xml.getBytes(StandardCharsets.UTF_8));
+ } finally {
if(stream != null) {
stream.close();
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
index 3e0490a77..947af08a2 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
@@ -21,8 +21,7 @@ import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.UnsupportedCharsetException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -139,16 +138,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws IOException if a problem occurred reading the stream.
*/
public static char[] getInputStreamAsCharArray(InputStream stream) throws IOException {
- Charset charset = null;
- try {
- charset = Charset.forName("UTF-8"); //$NON-NLS-1$
- } catch (IllegalCharsetNameException e) {
- System.err.println("Illegal charset name : " + "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- } catch(UnsupportedCharsetException e) {
- System.err.println("Unsupported charset : " + "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- }
+ Charset charset = StandardCharsets.UTF_8;
CharsetDecoder charsetDecoder = charset.newDecoder();
charsetDecoder.onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE);
byte[] contents = getInputStreamAsByteArray(stream, -1);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index dcf018cc0..258835629 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 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
@@ -16,6 +16,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -473,7 +474,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
file.createNewFile();
try (FileOutputStream stream = new FileOutputStream(file)) {
- stream.write(xml.getBytes("UTF8")); //$NON-NLS-1$
+ stream.write(xml.getBytes(StandardCharsets.UTF_8));
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java
index 78a4417b0..e615acb72 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,6 +17,7 @@ import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
+import java.nio.charset.StandardCharsets;
import java.util.Map.Entry;
import org.eclipse.core.resources.IMarker;
@@ -140,7 +141,7 @@ public class ExportBreakpointsOperation implements IRunnableWithProgress {
localmonitor.worked(1);
}
if (writer == null) {
- try (Writer outWriter = new OutputStreamWriter(new FileOutputStream(fFileName), "UTF-8")) { //$NON-NLS-1$
+ try (Writer outWriter = new OutputStreamWriter(new FileOutputStream(fFileName), StandardCharsets.UTF_8)) {
memento.save(outWriter);
}
} else {

Back to the top