Bug 518569 - Use StandardCharsets

Change-Id: Ia2c156836e394226b450c1ca5c1e335b93f1eb65
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java
index 0ecdde4..506750a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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,6 +11,7 @@
 package org.eclipse.team.internal.ccvs.ui;
 
 import java.io.*;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -25,7 +26,7 @@
 	protected static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
 
 public XMLWriter(OutputStream output) throws UnsupportedEncodingException {
-	super(new OutputStreamWriter(output, "UTF8")); //$NON-NLS-1$
+	super(new OutputStreamWriter(output, StandardCharsets.UTF_8));
 	tab = 0;
 	println(XML_VERSION);
 }
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
index 89791b6..c8713aa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -12,6 +12,7 @@
 
 import java.io.*;
 import java.lang.reflect.InvocationTargetException;
+import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.List;
 
@@ -193,10 +194,8 @@
 	private static XMLMemento filenameToXMLMemento(String filename) throws InvocationTargetException {
 		InputStreamReader reader = null;
 		try {
-			reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$
+			reader = new InputStreamReader(new FileInputStream(filename), StandardCharsets.UTF_8);
 			return XMLMemento.createReadRoot(reader);
-		} catch (UnsupportedEncodingException e) {
-			throw new InvocationTargetException(e);
 		} catch (FileNotFoundException e) {
 			throw new InvocationTargetException(e);
 		} catch (WorkbenchException e) {
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StreamMergerTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StreamMergerTest.java
index 21c9725..375406f 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StreamMergerTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StreamMergerTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -14,6 +14,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 import junit.framework.TestCase;
 
@@ -144,9 +145,9 @@
 	}
 
 	private IStatus merge(StringBuffer output, String a, String m, String y) throws UnsupportedEncodingException {
-		InputStream ancestor= new ByteArrayInputStream(a.getBytes(encoding));
-		InputStream target= new ByteArrayInputStream(m.getBytes(encoding));
-		InputStream other= new ByteArrayInputStream(y.getBytes(encoding));
+		InputStream ancestor= new ByteArrayInputStream(a.getBytes(StandardCharsets.UTF_8));
+		InputStream target= new ByteArrayInputStream(m.getBytes(StandardCharsets.UTF_8));
+		InputStream other= new ByteArrayInputStream(y.getBytes(StandardCharsets.UTF_8));
 
 		return merge(output, ancestor, target, other);
 	}
@@ -159,7 +160,7 @@
 		IStreamMerger merger= new TextStreamMerger();
 		IStatus status= merger.merge(os, encoding, ancestor, encoding, target, encoding, other, encoding, (IProgressMonitor) null);
 
-		output.append(new String(os.toByteArray(), encoding));
+		output.append(new String(os.toByteArray(), StandardCharsets.UTF_8));
 
 		return status;
 	}