Merge "Use StandardCharsets."
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java
index a34ad04..06ea7f9 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2017 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
@@ -11,6 +11,7 @@
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -796,7 +797,7 @@
ByteArrayOutputStream s = new ByteArrayOutputStream();
OutputStreamWriter writer;
try {
- writer = new OutputStreamWriter(s, "UTF8"); //$NON-NLS-1$
+ writer = new OutputStreamWriter(s, StandardCharsets.UTF_8); // $NON-NLS-1$
XMLWriter xmlWriter = new XMLWriter(writer, project,
false/*
* don't print XML version
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java
index 36ab72b..41acbf0 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 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
@@ -10,6 +10,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
@@ -91,7 +92,7 @@
IProjectFragment projectFragment = this.getProjectFragment();
if (charset == null) {
if (projectFragment.isArchive())
- charset = Charset.forName(Util.UTF_8);
+ charset = StandardCharsets.UTF_8;
}
PerformanceNode p = RuntimePerformanceMonitor.begin();
long length = 0;
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/UserLibrary.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/UserLibrary.java
index 7890539..e1a713d 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/UserLibrary.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/UserLibrary.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
@@ -14,6 +14,7 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Reader;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -126,7 +127,8 @@
boolean isSystemLibrary, Map<String, String> attributes)
throws IOException {
ByteArrayOutputStream s = new ByteArrayOutputStream();
- OutputStreamWriter writer = new OutputStreamWriter(s, "UTF8"); //$NON-NLS-1$
+ OutputStreamWriter writer = new OutputStreamWriter(s,
+ StandardCharsets.UTF_8); // $NON-NLS-1$
XMLWriter xmlWriter = new XMLWriter(writer,
null/*
* use the workspace line delimiter
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java
index 113fda1..2fbe5b6 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java
@@ -8,6 +8,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -20,7 +21,6 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.dltk.compiler.util.Util;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.core.environment.EnvironmentPathUtils;
@@ -359,7 +359,7 @@
}
public void testUtfLocale() throws ModelException, IOException {
- Charset charset = Charset.forName(Util.UTF_8);
+ Charset charset = StandardCharsets.UTF_8;
checkCharsetFlow(charset, "Русский текст2");
}