Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-03-14 02:31:51 -0400
committerFred Bricon2018-03-15 09:01:26 -0400
commitebef92f5e2f18310d65328ea2f5b96c8ec89708b (patch)
treee7e3cedee667121c5c58fc8f828941781cc9cd8d /org.eclipse.m2e.core
parenta4f8dc7748d38e08d01103be454f48c8b50cc2f3 (diff)
downloadm2e-core-ebef92f5e2f18310d65328ea2f5b96c8ec89708b.tar.gz
m2e-core-ebef92f5e2f18310d65328ea2f5b96c8ec89708b.tar.xz
m2e-core-ebef92f5e2f18310d65328ea2f5b96c8ec89708b.zip
Use StandardCharsets.
It allowed even removing guava dep from m2e.launching. Change-Id: Ieaa91358fcfa3c9b7f40f0a6197eddd6a9522c48 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.m2e.core')
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/content/XMLContentDescriber.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/content/XMLContentDescriber.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/content/XMLContentDescriber.java
index 3caad11e..d01c8b95 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/content/XMLContentDescriber.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/content/XMLContentDescriber.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2018 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
@@ -15,6 +15,8 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.content.IContentDescription;
@@ -41,13 +43,13 @@ class XMLContentDescriber extends TextContentDescriber implements ITextContentDe
public int describe(InputStream input, IContentDescription description) throws IOException {
byte[] bom = getByteOrderMark(input);
- String xmlDeclEncoding = "UTF-8"; //$NON-NLS-1$
+ Charset xmlDeclEncoding = StandardCharsets.UTF_8;
input.reset();
if(bom != null) {
if(bom == IContentDescription.BOM_UTF_16BE)
- xmlDeclEncoding = "UTF-16BE"; //$NON-NLS-1$
+ xmlDeclEncoding = StandardCharsets.UTF_16BE;
else if(bom == IContentDescription.BOM_UTF_16LE)
- xmlDeclEncoding = "UTF-16LE"; //$NON-NLS-1$
+ xmlDeclEncoding = StandardCharsets.UTF_16LE;
// skip BOM to make comparison simpler
input.skip(bom.length);
// set the BOM in the description if requested
@@ -78,7 +80,7 @@ class XMLContentDescriber extends TextContentDescriber implements ITextContentDe
return VALID;
}
- private String readFullXMLDecl(InputStream input, String unicodeEncoding) throws IOException {
+ private String readFullXMLDecl(InputStream input, Charset unicodeEncoding) throws IOException {
byte[] xmlDecl = new byte[100];
int c = 0;
// looks for XMLDecl ending char (?)

Back to the top