mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup - specify UTF_8 charset explicitly
GitOrigin-RevId: b6f12dabfc1a2d2bde4cdaa8f0455351c96e1556
This commit is contained in:
committed by
intellij-monorepo-bot
parent
df7296b5d5
commit
995b91a5de
+3
-1
@@ -7,6 +7,8 @@ import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.sun.jdi.ArrayReference;
|
||||
import com.sun.jdi.Value;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
@@ -24,7 +26,7 @@ final class ByteArrayAsStringRenderer extends CompoundReferenceRenderer {
|
||||
// TODO: read charset from the target vm
|
||||
byte[] bytes = DebuggerUtilsImpl.readBytesArray(value);
|
||||
if (bytes != null) {
|
||||
return new String(bytes);
|
||||
return new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,10 @@ import com.intellij.execution.process.*;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.actions.CloseAction;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -81,7 +84,7 @@ public class JShellHandler {
|
||||
myProcess = handler;
|
||||
|
||||
final PipedInputStream is = new PipedInputStream();
|
||||
final OutputStreamWriter readerSink = new OutputStreamWriter(new PipedOutputStream(is));
|
||||
final OutputStreamWriter readerSink = new OutputStreamWriter(new PipedOutputStream(is), StandardCharsets.UTF_8);
|
||||
myMessageReader = new MessageReader<>(is, Response.class);
|
||||
myMessageWriter = new MessageWriter<>(handler.getProcessInput());
|
||||
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.jshell.protocol;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -13,7 +14,7 @@ public class MessageReader<T> extends Endpoint {
|
||||
private final Class<T> myMsgType;
|
||||
|
||||
public MessageReader(InputStream input, Class<T> msgType) {
|
||||
myIn = new BufferedReader(new InputStreamReader(input));
|
||||
myIn = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
|
||||
myMsgType = msgType;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.jshell.protocol;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
@@ -11,7 +12,7 @@ public class MessageWriter<T extends Message> extends Endpoint {
|
||||
private final BufferedWriter myOut;
|
||||
|
||||
public MessageWriter(OutputStream output) {
|
||||
myOut = new BufferedWriter(new OutputStreamWriter(output));
|
||||
myOut = new BufferedWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public void send(T message) throws IOException {
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.util.projectWizard.importSources.util;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -26,6 +12,7 @@ import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public abstract class CommonSourceRootDetectionUtil<F> {
|
||||
|
||||
@@ -109,7 +96,7 @@ public abstract class CommonSourceRootDetectionUtil<F> {
|
||||
|
||||
private static char[] loadFileTextSkippingBom(File file) throws IOException {
|
||||
try (InputStream stream = CharsetToolkit.inputStreamSkippingBOM(new BufferedInputStream(new FileInputStream(file)));
|
||||
Reader reader = new InputStreamReader(stream)) {
|
||||
Reader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
|
||||
return FileUtilRt.loadText(reader, (int)file.length());
|
||||
}
|
||||
}
|
||||
|
||||
+7
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.jarRepository.services.artifactory;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@@ -27,6 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -48,7 +35,7 @@ public class ArtifactoryRepositoryService extends MavenRepositoryService {
|
||||
try {
|
||||
final Gson gson = new Gson();
|
||||
final InputStreamReader stream =
|
||||
new InputStreamReader(new Endpoint.Repositories(url).getRepositoryDetailsListJson(null).getInputStream());
|
||||
new InputStreamReader(new Endpoint.Repositories(url).getRepositoryDetailsListJson(null).getInputStream(), StandardCharsets.UTF_8);
|
||||
final ArtifactoryModel.RepositoryType[] repos = gson.fromJson(stream, ArtifactoryModel.RepositoryType[].class);
|
||||
final List<RemoteRepositoryDescription> result = new ArrayList<>(repos.length);
|
||||
for (ArtifactoryModel.RepositoryType repo : repos) {
|
||||
@@ -80,7 +67,8 @@ public class ArtifactoryRepositoryService extends MavenRepositoryService {
|
||||
final String name = StringUtil.join(Arrays.asList(template.getGroupId(), template.getArtifactId(), template.getVersion()), ":");
|
||||
final InputStream stream = new Endpoint.Search.Artifact(url).getArtifactSearchResultJson(name, null).getInputStream();
|
||||
|
||||
final ArtifactoryModel.GavcResults results = stream == null? null : gson.fromJson(new InputStreamReader(stream), ArtifactoryModel.GavcResults.class);
|
||||
final ArtifactoryModel.GavcResults results = stream == null? null : gson.fromJson(new InputStreamReader(stream,
|
||||
StandardCharsets.UTF_8), ArtifactoryModel.GavcResults.class);
|
||||
if (results != null && results.results != null) {
|
||||
for (ArtifactoryModel.GavcResult result : results.results) {
|
||||
if (!result.uri.endsWith(packaging)) continue;
|
||||
@@ -93,7 +81,8 @@ public class ArtifactoryRepositoryService extends MavenRepositoryService {
|
||||
final String searchString = className.endsWith("*") || className.endsWith("?") ? className : className + ".class";
|
||||
final InputStream stream = new Endpoint.Search.Archive(url).getArchiveSearchResultJson(searchString, null).getInputStream();
|
||||
|
||||
final ArtifactoryModel.ArchiveResults results = stream == null? null : gson.fromJson(new InputStreamReader(stream), ArtifactoryModel.ArchiveResults.class);
|
||||
final ArtifactoryModel.ArchiveResults results = stream == null? null : gson.fromJson(new InputStreamReader(stream,
|
||||
StandardCharsets.UTF_8), ArtifactoryModel.ArchiveResults.class);
|
||||
if (results != null && results.results != null) {
|
||||
for (ArtifactoryModel.ArchiveResult result : results.results) {
|
||||
for (String uri : result.archiveUris) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.jarRepository.services.bintray;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@@ -16,6 +16,7 @@ import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
@@ -225,7 +226,7 @@ public class BintrayEndpoint {
|
||||
private <Data> void handleRequest(HttpRequests.Request request, Class<Data> responseDataClass,
|
||||
ThrowableConsumer<Data, IOException> responseHandler) throws IOException {
|
||||
try (InputStream in = request.getInputStream();
|
||||
Reader reader = new InputStreamReader(in)) {
|
||||
Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) {
|
||||
Data data = gson.fromJson(reader, responseDataClass);
|
||||
responseHandler.consume(data);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.intellij.lang.annotations.Language;
|
||||
import javax.tools.*;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,7 @@ public class JavaInMemoryCompiler {
|
||||
final Iterable<? extends JavaFileObject> compilationUnits = Collections.singletonList(new JavaSourceFromString(className, code));
|
||||
final Iterable<String> options = Arrays.asList("-g"); // generate debugging info.
|
||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
||||
final OutputStreamWriter out = new OutputStreamWriter(System.err);
|
||||
final OutputStreamWriter out = new OutputStreamWriter(System.err, StandardCharsets.UTF_8);
|
||||
final Boolean success = myCompiler.getTask(out, myFileManager, diagnostics, options, null, compilationUnits).call();
|
||||
|
||||
if (!success.booleanValue()) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -23,6 +9,7 @@ import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage;
|
||||
@@ -120,7 +107,7 @@ public class CmdlineProtoUtil {
|
||||
try (PrintStream stream = new PrintStream(baos)) {
|
||||
cause.printStackTrace(stream);
|
||||
}
|
||||
final String stacktrace = new String(baos.toByteArray());
|
||||
final String stacktrace = new String(baos.toByteArray(), StandardCharsets.UTF_8);
|
||||
builder.setStacktrace(stacktrace);
|
||||
if (description == null) {
|
||||
builder.setDescription(stacktrace);
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
@Property(assertIfNoBindings = false)
|
||||
@@ -348,7 +349,7 @@ public abstract class InspectionProfileEntry implements BatchSuppressableTool {
|
||||
return;
|
||||
}
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
line = line.trim();
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.intellij.build;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
@@ -26,6 +12,7 @@ import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -36,7 +23,7 @@ public class JUnitLiveTestProgressFormatter implements JUnitResultFormatter, Ign
|
||||
|
||||
@Override
|
||||
public void setOutput(OutputStream out) {
|
||||
myOut = new PrintWriter(new OutputStreamWriter(out));
|
||||
myOut = new PrintWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.externalSystem.service;
|
||||
|
||||
import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
|
||||
@@ -29,6 +15,7 @@ import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.server.UnicastRemoteObject;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -172,14 +159,14 @@ public class RemoteExternalSystemFacadeImpl<S extends ExternalSystemExecutionSet
|
||||
int maxOffset = off + len;
|
||||
for (int i = off; i < maxOffset; i++) {
|
||||
if (b[i] == '\n') {
|
||||
myBuffer.append(new String(b, start, i - start + 1));
|
||||
myBuffer.append(new String(b, start, i - start + 1, StandardCharsets.UTF_8));
|
||||
doFlush();
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (start < maxOffset) {
|
||||
myBuffer.append(new String(b, start, maxOffset - start));
|
||||
myBuffer.append(new String(b, start, maxOffset - start, StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class OutputWrapper extends OutputStream {
|
||||
|
||||
@@ -42,7 +43,7 @@ public class OutputWrapper extends OutputStream {
|
||||
if (myBuffer == null) {
|
||||
myBuffer = new StringBuilder();
|
||||
}
|
||||
myBuffer.append(new String(b, start, i - start + 1));
|
||||
myBuffer.append(new String(b, start, i - start + 1, StandardCharsets.UTF_8));
|
||||
doFlush();
|
||||
start = i + 1;
|
||||
}
|
||||
@@ -52,7 +53,7 @@ public class OutputWrapper extends OutputStream {
|
||||
if (myBuffer == null) {
|
||||
myBuffer = new StringBuilder();
|
||||
}
|
||||
myBuffer.append(new String(b, start, maxOffset - start));
|
||||
myBuffer.append(new String(b, start, maxOffset - start, StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -81,7 +82,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable, ComponentHig
|
||||
private final CodeStyleSettings myCurrentSettings;
|
||||
private final Language myDefaultLanguage;
|
||||
private Document myDocumentBeforeChanges;
|
||||
|
||||
|
||||
protected CodeStyleAbstractPanel(@NotNull CodeStyleSettings settings) {
|
||||
this(null, null, settings);
|
||||
}
|
||||
@@ -270,7 +271,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable, ComponentHig
|
||||
|
||||
protected void prepareForReformat(PsiFile psiFile) {
|
||||
}
|
||||
|
||||
|
||||
protected String getFileExt() {
|
||||
return getFileTypeExtension(getFileType());
|
||||
}
|
||||
@@ -403,7 +404,8 @@ public abstract class CodeStyleAbstractPanel implements Disposable, ComponentHig
|
||||
|
||||
public static String readFromFile(final Class resourceContainerClass, @NonNls final String fileName) {
|
||||
try (InputStream stream = resourceContainerClass.getClassLoader().getResourceAsStream("codeStyle/preview/" + fileName);
|
||||
LineNumberReader lineNumberReader = stream == null ? null : new LineNumberReader(new InputStreamReader(stream))) {
|
||||
LineNumberReader lineNumberReader = stream == null ? null : new LineNumberReader(new InputStreamReader(stream,
|
||||
StandardCharsets.UTF_8))) {
|
||||
if (stream == null) throw new IOException("Resource not found: " + "codeStyle/preview/" + fileName);
|
||||
final StringBuilder result = new StringBuilder();
|
||||
String line;
|
||||
@@ -568,7 +570,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable, ComponentHig
|
||||
public Set<String> processListOptions() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
|
||||
public final void applyPredefinedSettings(@NotNull PredefinedCodeStyle codeStyle) {
|
||||
codeStyle.apply(mySettings);
|
||||
((CodeStyleSchemesModel.ModelSettings) mySettings).doWithLockedSettings(()->resetImpl(mySettings));
|
||||
@@ -578,7 +580,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable, ComponentHig
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method if the panel is linked to a specific language.
|
||||
* Override this method if the panel is linked to a specific language.
|
||||
* @return The language this panel is associated with.
|
||||
*/
|
||||
@Nullable
|
||||
@@ -589,11 +591,11 @@ public abstract class CodeStyleAbstractPanel implements Disposable, ComponentHig
|
||||
protected String getTabTitle() {
|
||||
return "Other";
|
||||
}
|
||||
|
||||
|
||||
protected CodeStyleSettings getCurrentSettings() {
|
||||
return myCurrentSettings;
|
||||
}
|
||||
|
||||
|
||||
public void setupCopyFromMenu(JPopupMenu copyMenu) {
|
||||
copyMenu.removeAll();
|
||||
}
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.application.options.colors.pluginExport;
|
||||
|
||||
import com.intellij.application.options.schemes.SerializableSchemeExporter;
|
||||
@@ -28,6 +14,7 @@ import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@@ -73,7 +60,7 @@ public class ColorSchemePluginExporter extends ConfigurableSchemeExporter<Plugin
|
||||
) throws IOException {
|
||||
ColorSchemePluginTemplate template = new ColorSchemePluginTemplate(scheme, exportData);
|
||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed") // Don't close the stream, there will be more content!
|
||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
|
||||
writer.write(template.getText());
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.documentation;
|
||||
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -357,7 +358,7 @@ public abstract class AbstractExternalFilter {
|
||||
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
|
||||
|
||||
if (contentEncoding == null) {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
|
||||
for (String htmlLine = reader.readLine(); htmlLine != null; htmlLine = reader.readLine()) {
|
||||
contentEncoding = parseContentEncoding(htmlLine);
|
||||
if (contentEncoding != null) {
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.console;
|
||||
|
||||
import com.intellij.execution.process.BaseOSProcessHandler;
|
||||
@@ -23,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
@@ -55,7 +42,7 @@ public class ProcessBackedConsoleExecuteActionHandler extends BaseConsoleExecute
|
||||
final OutputStream outputStream = myProcessHandler.getProcessInput();
|
||||
assert outputStream != null : "output stream is null";
|
||||
try {
|
||||
byte[] bytes = charset != null ? line.getBytes(charset) : line.getBytes();
|
||||
byte[] bytes = charset != null ? line.getBytes(charset) : line.getBytes(StandardCharsets.UTF_8);
|
||||
outputStream.write(bytes);
|
||||
outputStream.flush();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.history.core;
|
||||
|
||||
@@ -21,6 +7,7 @@ import com.intellij.history.integration.IdeaGateway;
|
||||
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public abstract class Content {
|
||||
public void write(DataOutput out) throws IOException {
|
||||
@@ -42,7 +29,7 @@ public abstract class Content {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new String(getBytes());
|
||||
return new String(getBytes(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.diff;
|
||||
|
||||
import com.intellij.ide.util.PsiNavigationSupport;
|
||||
@@ -26,6 +12,8 @@ import com.intellij.util.LineSeparator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class DocumentContent extends DiffContent {
|
||||
private final Document myDocument;
|
||||
private final VirtualFile myFile;
|
||||
@@ -80,7 +68,7 @@ public class DocumentContent extends DiffContent {
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() {
|
||||
return myDocument.getText().getBytes();
|
||||
return myDocument.getText().getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.diff;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -32,6 +18,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Allows to compare some text not associated with file or document.
|
||||
@@ -58,7 +45,7 @@ public class SimpleContent extends DiffContent {
|
||||
}
|
||||
|
||||
public SimpleContent(@NotNull String text, FileType type) {
|
||||
myOriginalBytes = text.getBytes();
|
||||
myOriginalBytes = text.getBytes(StandardCharsets.UTF_8);
|
||||
myOriginalText = myLineSeparators.correctText(text);
|
||||
myDocument = EditorFactory.getInstance().createDocument(myOriginalText);
|
||||
setReadOnly(true);
|
||||
@@ -134,7 +121,7 @@ public class SimpleContent extends DiffContent {
|
||||
buffer.get(result, bomLength, encodedLength);
|
||||
return result;
|
||||
}
|
||||
return currentText.getBytes();
|
||||
return currentText.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.application.options.schemes;
|
||||
|
||||
import com.intellij.configurationStore.SerializableScheme;
|
||||
@@ -28,6 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Exports (copies) a scheme to an external file as is.
|
||||
@@ -61,7 +48,7 @@ public class SerializableSchemeExporter extends SchemeExporter<Scheme> {
|
||||
}
|
||||
|
||||
private static void writeToStream(@NotNull OutputStream outputStream, @NotNull Element element) throws IOException {
|
||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
|
||||
Format format = Format.getPrettyFormat();
|
||||
format.setLineSeparator("\n");
|
||||
new XMLOutputter(format).output(element, writer);
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.execution.process.impl;
|
||||
|
||||
@@ -34,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -125,7 +112,7 @@ public class ProcessListUtil {
|
||||
List<String> cmdline;
|
||||
try (FileInputStream stream = new FileInputStream(new File(each, "cmdline"))) {
|
||||
//noinspection SSBasedInspection - no better candidate for system encoding anyways
|
||||
String cmdlineString = new String(FileUtil.loadBytes(stream));
|
||||
String cmdlineString = new String(FileUtil.loadBytes(stream), StandardCharsets.UTF_8);
|
||||
cmdline = StringUtil.split(cmdlineString, "\0");
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.idea;
|
||||
|
||||
import com.intellij.diagnostic.LogMessage;
|
||||
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author Mike
|
||||
@@ -44,7 +45,7 @@ public class IdeaLogger extends Log4jBasedLogger {
|
||||
String stamp = null;
|
||||
URL resource = Logger.class.getResource("/.compilation-timestamp");
|
||||
if (resource != null) {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream()))) {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream(), StandardCharsets.UTF_8))) {
|
||||
String s = reader.readLine();
|
||||
if (s != null) {
|
||||
stamp = s.trim();
|
||||
@@ -141,7 +142,7 @@ public class IdeaLogger extends Log4jBasedLogger {
|
||||
"; VM: " + System.getProperties().getProperty("java.vm.name", "unknown") +
|
||||
"; Vendor: " + System.getProperties().getProperty("java.vendor", "unknown"));
|
||||
myLogger.error("OS: " + System.getProperties().getProperty("os.name", "unknown"));
|
||||
|
||||
|
||||
IdeaPluginDescriptor plugin = t == null ? null : PluginManager.findPluginIfInitialized(t);
|
||||
if (plugin != null && (!plugin.isBundled() || plugin.allowBundledUpdate())) {
|
||||
myLogger.error("Plugin to blame: " + plugin.getName() + " version: " + plugin.getVersion());
|
||||
|
||||
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.idea;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -51,7 +38,7 @@ public class Launcher {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Reader reader = new InputStreamReader(myInput);
|
||||
Reader reader = new InputStreamReader(myInput, StandardCharsets.UTF_8);
|
||||
do {
|
||||
int ch = 0;
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.cachedValueProfiler;
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,7 +21,7 @@ public class CVPReader {
|
||||
|
||||
@NotNull
|
||||
public static List<CVPInfo> deserialize(@NotNull InputStream stream) throws IOException {
|
||||
try (JsonReader reader = new JsonReader(new InputStreamReader(stream))) {
|
||||
try (JsonReader reader = new JsonReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
|
||||
return new CVPReader(reader).read();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.eventLog;
|
||||
|
||||
import com.intellij.internal.statistic.connect.StatServiceException;
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -86,7 +87,7 @@ public class EventLogStatisticsService implements StatisticsService {
|
||||
.tuner(connection -> connection.setRequestProperty("Content-Encoding", "gzip"))
|
||||
.connect(request -> {
|
||||
final BufferExposingByteArrayOutputStream out = new BufferExposingByteArrayOutputStream();
|
||||
try (OutputStreamWriter writer = new OutputStreamWriter(new GZIPOutputStream(out))) {
|
||||
try (OutputStreamWriter writer = new OutputStreamWriter(new GZIPOutputStream(out), StandardCharsets.UTF_8)) {
|
||||
LogEventSerializer.INSTANCE.toString(recordRequest, writer);
|
||||
}
|
||||
request.write(out.toByteArray());
|
||||
|
||||
+2
-1
@@ -19,6 +19,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Deprecated
|
||||
public interface MergeVersion {
|
||||
@@ -102,7 +103,7 @@ public interface MergeVersion {
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
VirtualFile file = getFile();
|
||||
return file != null ? file.contentsToByteArray() : myDocument.getText().getBytes();
|
||||
return file != null ? file.contentsToByteArray() : myDocument.getText().getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.history.core;
|
||||
|
||||
@@ -213,7 +199,7 @@ public abstract class LocalHistoryTestCase extends Assert {
|
||||
}
|
||||
|
||||
protected static void assertContent(String expected, Content c) {
|
||||
assertEquals(expected, new String(c.getBytes()));
|
||||
assertEquals(expected, new String(c.getBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
protected static void assertEquals(Object[] expected, Collection actual) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.history.core;
|
||||
|
||||
@@ -20,6 +6,7 @@ import com.intellij.history.core.revisions.Revision;
|
||||
import com.intellij.history.core.tree.RootEntry;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
public class LocalVcsLabelsTest extends LocalHistoryTestCase {
|
||||
@@ -147,8 +134,8 @@ public class LocalVcsLabelsTest extends LocalHistoryTestCase {
|
||||
LabelImpl l3 = myVcs.putSystemLabel("label", "project", -1);
|
||||
|
||||
assertNull(l1.getByteContent(myRoot, "f").getBytes());
|
||||
assertEquals("one", new String(l2.getByteContent(myRoot, "f").getBytes()));
|
||||
assertEquals("two", new String(l3.getByteContent(myRoot, "f").getBytes()));
|
||||
assertEquals("one", new String(l2.getByteContent(myRoot, "f").getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("two", new String(l3.getByteContent(myRoot, "f").getBytes(), StandardCharsets.UTF_8));
|
||||
|
||||
add(myVcs, createDirectory(myRoot, "dir"));
|
||||
LabelImpl l4 = myVcs.putSystemLabel("label", "project", -1);
|
||||
@@ -156,7 +143,7 @@ public class LocalVcsLabelsTest extends LocalHistoryTestCase {
|
||||
assertTrue(l4.getByteContent(myRoot, "dir").isDirectory());
|
||||
assertNull(l4.getByteContent(myRoot, "dir").getBytes());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGettingByteContentInsideChangeSet() {
|
||||
myVcs.beginChangeSet();
|
||||
@@ -166,8 +153,8 @@ public class LocalVcsLabelsTest extends LocalHistoryTestCase {
|
||||
LabelImpl l2 = myVcs.putSystemLabel("label", "project", -1);
|
||||
myVcs.endChangeSet(null);
|
||||
|
||||
assertEquals("one", new String(l1.getByteContent(myRoot, "f").getBytes()));
|
||||
assertEquals("two", new String(l2.getByteContent(myRoot, "f").getBytes()));
|
||||
assertEquals("one", new String(l1.getByteContent(myRoot, "f").getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("two", new String(l2.getByteContent(myRoot, "f").getBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -181,8 +168,8 @@ public class LocalVcsLabelsTest extends LocalHistoryTestCase {
|
||||
|
||||
LabelImpl l3 = myVcs.putSystemLabel("label", "project", -1);
|
||||
|
||||
assertEquals("one", new String(l1.getByteContent(myRoot, "f_r").getBytes()));
|
||||
assertEquals("two", new String(l2.getByteContent(myRoot, "f_r").getBytes()));
|
||||
assertEquals("two", new String(l3.getByteContent(myRoot, "f_r").getBytes()));
|
||||
assertEquals("one", new String(l1.getByteContent(myRoot, "f_r").getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("two", new String(l2.getByteContent(myRoot, "f_r").getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("two", new String(l3.getByteContent(myRoot, "f_r").getBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.history.integration;
|
||||
|
||||
import com.intellij.history.LocalHistory;
|
||||
@@ -14,6 +14,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
@@ -85,14 +86,14 @@ public class BasicsTest extends IntegrationTestCase {
|
||||
|
||||
List<Revision> rr = getRevisionsFor(f);
|
||||
assertEquals(9, rr.size()); // 5 changes + 3 labels
|
||||
assertEquals("4", new String(rr.get(0).findEntry().getContent().getBytes()));
|
||||
assertEquals("4", new String(rr.get(1).findEntry().getContent().getBytes()));
|
||||
assertEquals("3", new String(rr.get(2).findEntry().getContent().getBytes()));
|
||||
assertEquals("3", new String(rr.get(3).findEntry().getContent().getBytes()));
|
||||
assertEquals("2", new String(rr.get(4).findEntry().getContent().getBytes()));
|
||||
assertEquals("2", new String(rr.get(5).findEntry().getContent().getBytes()));
|
||||
assertEquals("1", new String(rr.get(6).findEntry().getContent().getBytes()));
|
||||
assertEquals("", new String(rr.get(7).findEntry().getContent().getBytes()));
|
||||
assertEquals("4", new String(rr.get(0).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("4", new String(rr.get(1).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("3", new String(rr.get(2).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("3", new String(rr.get(3).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("2", new String(rr.get(4).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("2", new String(rr.get(5).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("1", new String(rr.get(6).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("", new String(rr.get(7).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public void testDoNotRegisterSameUnsavedDocumentContentTwice() {
|
||||
@@ -105,11 +106,11 @@ public class BasicsTest extends IntegrationTestCase {
|
||||
|
||||
List<Revision> rr = getRevisionsFor(f);
|
||||
assertEquals(6, rr.size()); // 3 changes + 2 labels
|
||||
assertEquals("2", new String(rr.get(0).findEntry().getContent().getBytes()));
|
||||
assertEquals("2", new String(rr.get(1).findEntry().getContent().getBytes()));
|
||||
assertEquals("2", new String(rr.get(2).findEntry().getContent().getBytes()));
|
||||
assertEquals("1", new String(rr.get(3).findEntry().getContent().getBytes()));
|
||||
assertEquals("", new String(rr.get(4).findEntry().getContent().getBytes()));
|
||||
assertEquals("2", new String(rr.get(0).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("2", new String(rr.get(1).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("2", new String(rr.get(2).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("1", new String(rr.get(3).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
assertEquals("", new String(rr.get(4).findEntry().getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public void testIsUnderControl() {
|
||||
|
||||
+4
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.history.integration;
|
||||
|
||||
@@ -23,6 +9,8 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.util.Clock;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class GettingContentAtDateTest extends IntegrationTestCase {
|
||||
private VirtualFile f;
|
||||
|
||||
@@ -129,7 +117,7 @@ public class GettingContentAtDateTest extends IntegrationTestCase {
|
||||
|
||||
private void assertContentAt(FileRevisionTimestampComparator c, String expected) {
|
||||
byte[] actual = LocalHistory.getInstance().getByteContent(f, c);
|
||||
assertEquals(expected, actual == null ? null : new String(actual));
|
||||
assertEquals(expected, actual == null ? null : new String(actual, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private FileRevisionTimestampComparator comparator(final long timestamp) {
|
||||
|
||||
+1
-1
@@ -199,6 +199,6 @@ public abstract class IntegrationTestCase extends PlatformTestCase {
|
||||
}
|
||||
|
||||
protected static void assertContent(String expected, Entry e) {
|
||||
assertEquals(expected, new String(e.getContent().getBytes()));
|
||||
assertEquals(expected, new String(e.getContent().getBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.history.integration.ui;
|
||||
|
||||
@@ -109,7 +95,7 @@ public class SelectionHistoryDialogTest extends LocalHistoryUITestCase {
|
||||
byte[] bytes = f.contentsToByteArray();
|
||||
delete(f);
|
||||
|
||||
f = createFile(f.getName(), new String(bytes));
|
||||
f = createFile(f.getName(), new String(bytes, StandardCharsets.UTF_8));
|
||||
loadContent(f);
|
||||
|
||||
initModelOnSecondLineAndSelectRevisions(3, 3);
|
||||
@@ -123,7 +109,7 @@ public class SelectionHistoryDialogTest extends LocalHistoryUITestCase {
|
||||
Reverter r = m.createReverter();
|
||||
r.revert();
|
||||
|
||||
assertEquals("a\nbc\nc\ne\n", new String(f.contentsToByteArray()));
|
||||
assertEquals("a\nbc\nc\ne\n", new String(f.contentsToByteArray(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private void initModelOnSecondLineAndSelectRevisions(int first, int second) {
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.history.integration.ui.models;
|
||||
|
||||
@@ -26,6 +12,7 @@ import com.intellij.history.integration.IdeaGateway;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static org.easymock.EasyMock.*;
|
||||
@@ -134,7 +121,7 @@ public class SelectionCalculatorTest extends LocalHistoryTestCase {
|
||||
private static class MyIdeaGateway extends IdeaGateway {
|
||||
@Override
|
||||
public String stringFromBytes(@NotNull byte[] bytes, @NotNull String path) {
|
||||
return new String(bytes);
|
||||
return new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor.richcopy;
|
||||
|
||||
import com.intellij.openapi.editor.richcopy.view.HtmlTransferableData;
|
||||
@@ -30,6 +16,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class RichCopyTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
private static final String PLATFORM_SPECIFIC_PLACEHOLDER = "___PLATFORM_SPECIFIC___";
|
||||
@@ -87,7 +74,7 @@ public class RichCopyTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
private static String readFully(InputStream inputStream) throws IOException {
|
||||
return new String(FileUtilRt.loadBytes(inputStream));
|
||||
return new String(FileUtilRt.loadBytes(inputStream), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static String readFully(Reader reader) throws IOException {
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.remoteServer.impl.runtime.log;
|
||||
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
@@ -24,6 +10,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class ConsoleTerminalHandlerImpl extends TerminalHandlerBase {
|
||||
|
||||
@@ -64,7 +51,7 @@ public class ConsoleTerminalHandlerImpl extends TerminalHandlerBase {
|
||||
Disposer.register(this, myLoggingHandler);
|
||||
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
||||
try (BufferedReader outputReader = new BufferedReader(new InputStreamReader(terminalOutput))) {
|
||||
try (BufferedReader outputReader = new BufferedReader(new InputStreamReader(terminalOutput, StandardCharsets.UTF_8))) {
|
||||
while (!isClosed()) {
|
||||
String line = outputReader.readLine();
|
||||
if (line == null) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij;
|
||||
|
||||
import com.intellij.idea.Bombed;
|
||||
@@ -26,6 +26,7 @@ import java.lang.reflect.AnnotatedElement;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
@@ -95,7 +96,7 @@ public class TestCaseLoader {
|
||||
MultiMap<String, String> groups = MultiMap.createLinked();
|
||||
|
||||
for (URL fileUrl : groupingFileUrls) {
|
||||
try (InputStreamReader reader = new InputStreamReader(fileUrl.openStream())) {
|
||||
try (InputStreamReader reader = new InputStreamReader(fileUrl.openStream(), StandardCharsets.UTF_8)) {
|
||||
groups.putAllValues(GroupBasedTestClassFilter.readGroups(reader));
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
@@ -151,7 +151,7 @@ public class IoTestUtil {
|
||||
Process process = builder.start();
|
||||
StringBuilder output = new StringBuilder();
|
||||
Thread thread = new Thread(() -> {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append('\n');
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -33,6 +19,7 @@ import org.junit.rules.TestWatcher;
|
||||
import org.junit.runner.Description;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -129,7 +116,7 @@ public class TestLoggerFactory implements Logger.Factory {
|
||||
file.seek(length - LOG_SEEK_WINDOW);
|
||||
byte[] bytes = new byte[(int)LOG_SEEK_WINDOW];
|
||||
int read = file.read(bytes);
|
||||
logText = new String(bytes, 0, read);
|
||||
logText = new String(bytes, 0, read, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@ public class TestClassesFilterTest {
|
||||
}
|
||||
|
||||
private static InputStreamReader getReader(String filterText) {
|
||||
return new InputStreamReader(new ByteArrayInputStream(filterText.getBytes(StandardCharsets.UTF_8)));
|
||||
return new InputStreamReader(new ByteArrayInputStream(filterText.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static void checkForAllExcludedDefinedGroup(TestClassesFilter classesFilter) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.util.ObjectUtils.assertNotNull;
|
||||
@@ -209,8 +210,8 @@ public class UnixProcessManager {
|
||||
}
|
||||
|
||||
private static void processCommandOutput(Process process, Processor<? super String> processor, boolean skipFirstLine, boolean throwOnError) throws IOException {
|
||||
try (BufferedReader stdOutput = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
|
||||
try (BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {
|
||||
try (BufferedReader stdOutput = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
try (BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8))) {
|
||||
if (skipFirstLine) {
|
||||
stdOutput.readLine(); //ps output header
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public class JDOMUtil {
|
||||
|
||||
@NotNull
|
||||
public static Document loadDocument(@NotNull File file) throws JDOMException, IOException {
|
||||
return loadDocumentUsingStaX(new BufferedReader(new InputStreamReader(new FileInputStream(file))));
|
||||
return loadDocumentUsingStaX(new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -220,7 +220,7 @@ public class FileUtil extends FileUtilRt {
|
||||
|
||||
@NotNull
|
||||
public static String loadTextAndClose(@NotNull InputStream stream) throws IOException {
|
||||
return loadTextAndClose(new InputStreamReader(stream));
|
||||
return loadTextAndClose(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.util.io;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -23,6 +9,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class StreamUtil {
|
||||
private static final Logger LOG = Logger.getInstance(StreamUtil.class);
|
||||
@@ -67,7 +54,7 @@ public class StreamUtil {
|
||||
@NotNull
|
||||
public static String readText(@NotNull InputStream inputStream) throws IOException {
|
||||
final byte[] data = loadFromStream(inputStream);
|
||||
return new String(data);
|
||||
return new String(data, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.util.io;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -21,6 +7,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -86,7 +73,7 @@ public class WindowsRegistryUtil {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public static List<String> readRegistryBranchValues(@NotNull String location) {
|
||||
List<String> result = new ArrayList<>();
|
||||
@@ -131,7 +118,7 @@ public class WindowsRegistryUtil {
|
||||
for (int length = is.read(buffer); length > 0; length = is.read(buffer)) {
|
||||
os.write(buffer, 0, length);
|
||||
}
|
||||
output = new StringBuilder(new String(os.toByteArray()));
|
||||
output = new StringBuilder(new String(os.toByteArray(), StandardCharsets.UTF_8));
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @deprecated Please use {@link java.util.Base64} instead
|
||||
*/
|
||||
@@ -52,7 +40,7 @@ public class Base64Converter {
|
||||
};
|
||||
|
||||
public static String encode(@NotNull String s) {
|
||||
return encode(s.getBytes());
|
||||
return encode(s.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public static String encode(@NotNull byte[] octetString) {
|
||||
@@ -114,7 +102,7 @@ public class Base64Converter {
|
||||
}
|
||||
|
||||
public static String decode(@NotNull String s) {
|
||||
return new String(decode(s.getBytes()));
|
||||
return new String(decode(s.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static byte[] decode(@NotNull byte[] bytes) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
* @author max
|
||||
@@ -24,6 +10,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.Inflater;
|
||||
@@ -53,7 +40,7 @@ public class SourceCodeCompressor {
|
||||
"<html>/>\r\n<head</head><body bgcolor=</body>table<?xml version=\"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML" +
|
||||
"titleframecaret<a href=\"http://</a><div </div><td </td><tr </tr><p </p><hscripttext/css<img src=" +
|
||||
"<!--><link rel=width=height=align=span=centerrightleftstyle=celljsp:rootxmlns:avascript";
|
||||
PRESET_BUF = preset_buf_string.getBytes();
|
||||
PRESET_BUF = preset_buf_string.getBytes(StandardCharsets.UTF_8);
|
||||
OUTPUT = new VaultOutputStream();
|
||||
DEFLATER = new Deflater(Deflater.BEST_COMPRESSION);
|
||||
INFLATER = new Inflater();
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util.io;
|
||||
|
||||
import com.intellij.openapi.util.io.ByteArraySequence;
|
||||
@@ -21,6 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class UnsyncByteArrayOutputStream extends OutputStream {
|
||||
@@ -94,7 +81,7 @@ public class UnsyncByteArrayOutputStream extends OutputStream {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new String(myBuffer, 0, myCount);
|
||||
return new String(myBuffer, 0, myCount, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
* @author max
|
||||
@@ -24,6 +10,7 @@ import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.zip.*;
|
||||
|
||||
@@ -318,7 +305,7 @@ class JBZipOutputStream {
|
||||
*/
|
||||
protected byte[] getBytes(String name) throws ZipException {
|
||||
if (encoding == null) {
|
||||
return name.getBytes();
|
||||
return name.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
@@ -24,6 +10,7 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
@@ -87,7 +74,7 @@ public class PathInternerTest extends TestCase {
|
||||
}
|
||||
System.out.println("Map collected, press when ready");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
|
||||
reader.readLine();
|
||||
|
||||
System.out.println("Filling THashSet...");
|
||||
|
||||
@@ -54,7 +54,7 @@ public class UpdateableZipTest extends TestCase {
|
||||
try (ZipFile utilZip = new ZipFile(zipFile)) {
|
||||
ZipEntry thirdEntry = utilZip.getEntry("/third");
|
||||
assertNotNull(thirdEntry);
|
||||
String thirdText = FileUtil.loadTextAndClose(new InputStreamReader(utilZip.getInputStream(thirdEntry)));
|
||||
String thirdText = FileUtil.loadTextAndClose(new InputStreamReader(utilZip.getInputStream(thirdEntry), StandardCharsets.UTF_8));
|
||||
assertEquals("third", thirdText);
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class UpdateableZipTest extends TestCase {
|
||||
try (ZipFile utilZip = new ZipFile(zipFile)) {
|
||||
ZipEntry updatedEntry = utilZip.getEntry("/second");
|
||||
assertNotNull(updatedEntry);
|
||||
String thirdText = FileUtil.loadTextAndClose(new InputStreamReader(utilZip.getInputStream(updatedEntry)));
|
||||
String thirdText = FileUtil.loadTextAndClose(new InputStreamReader(utilZip.getInputStream(updatedEntry), StandardCharsets.UTF_8));
|
||||
assertEquals("Content Replaced", thirdText);
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ public class UpdateableZipTest extends TestCase {
|
||||
private static void assertEntryWithContentExists(JBZipFile jbZip, String entryName, String content) throws IOException {
|
||||
JBZipEntry entry = jbZip.getEntry(entryName);
|
||||
assertNotNull(entry);
|
||||
String text = new String(entry.getData());
|
||||
String text = new String(entry.getData(), StandardCharsets.UTF_8);
|
||||
assertEquals(content, text);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.vcs;
|
||||
|
||||
import com.intellij.notification.Notification;
|
||||
@@ -29,6 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -105,9 +92,9 @@ public class VcsTestUtil {
|
||||
WriteCommandAction.writeCommandAction(project).run(() -> {
|
||||
try {
|
||||
final long newTs = Math.max(System.currentTimeMillis(), file.getTimeStamp() + 1100);
|
||||
file.setBinaryContent(newContent.getBytes(), -1, newTs);
|
||||
file.setBinaryContent(newContent.getBytes(StandardCharsets.UTF_8), -1, newTs);
|
||||
final File file1 = new File(file.getPath());
|
||||
FileUtil.writeToFile(file1, newContent.getBytes());
|
||||
FileUtil.writeToFile(file1, newContent.getBytes(StandardCharsets.UTF_8));
|
||||
file.refresh(false, false);
|
||||
assertTrue(file1 + " / " + newTs, file1.setLastModified(newTs));
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.testFramework.vcs;
|
||||
|
||||
import com.intellij.execution.process.CapturingProcessHandler;
|
||||
@@ -28,6 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -82,7 +69,7 @@ public class TestClientRunner {
|
||||
|
||||
if (stdin != null) {
|
||||
try (OutputStream outputStream = clientProcess.getOutputStream()) {
|
||||
final byte[] bytes = stdin.getBytes();
|
||||
final byte[] bytes = stdin.getBytes(StandardCharsets.UTF_8);
|
||||
outputStream.write(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.xdebugger.attach.osHandlers;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
@@ -11,6 +11,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -59,7 +60,7 @@ public abstract class UnixAttachOSHandler extends AttachOSHandler {
|
||||
LOGGER.warn(PTRACE_SCOPE_PATH + " file exists but you don't have permissions to read it.");
|
||||
return 3; // The strongest possible level
|
||||
}
|
||||
final BufferedReader buf = new BufferedReader(new InputStreamReader(fileStream));
|
||||
final BufferedReader buf = new BufferedReader(new InputStreamReader(fileStream, StandardCharsets.UTF_8));
|
||||
|
||||
final String fileContent = buf.readLine();
|
||||
try (Scanner scanner = new Scanner(fileContent)) {
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.cvsSupport2.connections.ssh;
|
||||
|
||||
import com.trilead.ssh2.Connection;
|
||||
@@ -22,6 +8,7 @@ import org.netbeans.lib.cvsclient.connection.AuthenticationException;
|
||||
import org.netbeans.lib.cvsclient.connection.ConnectionSettings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class SshConnectionUtils {
|
||||
private static final int SSH_DEFAULT_PORT = 22;
|
||||
@@ -47,6 +34,6 @@ public class SshConnectionUtils {
|
||||
|
||||
public static boolean connectionSupportsPing(final Connection connection) {
|
||||
final ClientServerHello csh = connection.getClientServerHello();
|
||||
return (csh != null) && (csh.getServerString() != null) && (new String(csh.getServerString()).contains("OpenSSH"));
|
||||
return (csh != null) && (csh.getServerString() != null) && (new String(csh.getServerString(), StandardCharsets.UTF_8).contains("OpenSSH"));
|
||||
}
|
||||
}
|
||||
|
||||
+7
-17
@@ -1,23 +1,13 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.cvsSupport2.actions.merge;
|
||||
|
||||
import com.intellij.util.containers.Stack;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author lesya
|
||||
@@ -59,7 +49,7 @@ public class CvsConflictsParser {
|
||||
}
|
||||
|
||||
private void parseFile(final InputStream merged) throws IOException {
|
||||
final BufferedReader br = new BufferedReader(new InputStreamReader(merged));
|
||||
final BufferedReader br = new BufferedReader(new InputStreamReader(merged, StandardCharsets.UTF_8));
|
||||
try {
|
||||
for (String line; (line = br.readLine()) != null; ) {
|
||||
if (!processLeftMarker(line) && !processRightMarker(line) && !processEndMarker(line)) {
|
||||
|
||||
+5
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.cvsSupport2.actions.merge;
|
||||
|
||||
import com.intellij.cvsSupport2.CvsUtil;
|
||||
@@ -30,6 +16,7 @@ import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author lesya
|
||||
@@ -53,9 +40,9 @@ public class CvsMergeProvider implements MergeProvider {
|
||||
try {
|
||||
final CvsConflictsParser parser = CvsConflictsParser.createOn(input);
|
||||
final MergeData mergeData = new MergeData();
|
||||
mergeData.ORIGINAL = parser.getCenterVersion().getBytes();
|
||||
mergeData.CURRENT = parser.getLeftVersion().getBytes();
|
||||
mergeData.LAST = parser.getRightVersion().getBytes();
|
||||
mergeData.ORIGINAL = parser.getCenterVersion().getBytes(StandardCharsets.UTF_8);
|
||||
mergeData.CURRENT = parser.getLeftVersion().getBytes(StandardCharsets.UTF_8);
|
||||
mergeData.LAST = parser.getRightVersion().getBytes(StandardCharsets.UTF_8);
|
||||
return mergeData;
|
||||
}
|
||||
finally {
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.cvsSupport2.config;
|
||||
|
||||
import com.intellij.openapi.components.*;
|
||||
@@ -16,6 +16,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -165,7 +166,7 @@ public class CvsApplicationLevelConfiguration implements PersistentStateComponen
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(passFile)));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(passFile), StandardCharsets.UTF_8));
|
||||
try {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.cvsSupport2.cvsIgnore;
|
||||
|
||||
import com.intellij.cvsSupport2.application.CvsEntriesManager;
|
||||
@@ -21,6 +7,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.netbeans.lib.cvsclient.util.SimpleStringPattern;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
@@ -99,7 +86,7 @@ public class IgnoredFilesInfoImpl implements IgnoredFilesInfo {
|
||||
if (!cvsIgnoreFile.exists()) return result;
|
||||
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(cvsIgnoreFile)));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(cvsIgnoreFile), StandardCharsets.UTF_8));
|
||||
try{
|
||||
String line;
|
||||
while((line = reader.readLine()) != null){
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.netbeans.lib.cvsclient.io.IStreamLogger;
|
||||
import org.netbeans.lib.cvsclient.util.BugLog;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
@@ -59,7 +60,7 @@ public final class ConnectionStreams
|
||||
|
||||
@Override
|
||||
public Reader createReader(InputStream inputStream) {
|
||||
return new InputStreamReader(inputStream);
|
||||
return new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ import org.netbeans.lib.cvsclient.request.CommandRequest;
|
||||
import org.netbeans.lib.cvsclient.request.Requests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author Thomas Singer
|
||||
@@ -80,7 +81,7 @@ public final class EditCommand extends AbstractCommand {
|
||||
|
||||
if (parser.isFilesEdited()) {
|
||||
final String message = JavaCvsSrcBundle.message("cannot.edit.files.they.are.edited.error.message");
|
||||
eventSender.notifyMessageListeners(message.getBytes(),true, false);
|
||||
eventSender.notifyMessageListeners(message.getBytes(StandardCharsets.UTF_8), true, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import org.netbeans.lib.cvsclient.util.BugLog;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Implements a connection to a pserver. See the cvs documents for more
|
||||
@@ -220,7 +221,7 @@ public final class PServerConnection
|
||||
|
||||
private static void writeLn(final OutputStream outputStream, final String line) throws IOException {
|
||||
final String line1 = line + "\n";
|
||||
outputStream.write(line1.getBytes());
|
||||
outputStream.write(line1.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private void createSocket() throws IOException {
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.netbeans.lib.cvsclient.io;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author Thomas Singer
|
||||
@@ -31,7 +32,7 @@ public final class StreamUtilities {
|
||||
if (myCharset != null) {
|
||||
return new String(readLineBytes(reader), myCharset);
|
||||
} else {
|
||||
return new String(readLineBytes(reader));
|
||||
return new String(readLineBytes(reader), StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.appengine.sdk.impl;
|
||||
|
||||
import com.intellij.appengine.sdk.AppEngineSdk;
|
||||
@@ -35,6 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.appengine.model.impl.JpsAppEngineModuleExtensionImpl;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.jar.Attributes;
|
||||
|
||||
@@ -243,7 +230,7 @@ public class AppEngineSdkImpl implements AppEngineSdk {
|
||||
final InputStream stream = getClass().getResourceAsStream("/data/methodsBlacklist.txt");
|
||||
LOG.assertTrue(stream != null, "/data/methodsBlacklist.txt not found");
|
||||
final THashMap<String, Set<String>> map = new THashMap<>();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
try {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.jps.gradle.compiler;
|
||||
|
||||
import com.intellij.openapi.util.Ref;
|
||||
@@ -32,6 +18,7 @@ import org.jetbrains.jps.model.JpsEncodingProjectConfiguration;
|
||||
import org.jetbrains.jps.model.JpsProject;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -94,7 +81,7 @@ public class GradleResourceFileProcessor {
|
||||
}
|
||||
|
||||
private static InputStream transform(List<ResourceRootFilter> filters, FileInputStream original, Ref<File> outputFileRef, CompileContext context) {
|
||||
final InputStreamReader streamReader = new InputStreamReader(original);
|
||||
final InputStreamReader streamReader = new InputStreamReader(original, StandardCharsets.UTF_8);
|
||||
final Reader newReader = new ChainingFilterTransformer(context, filters, outputFileRef).transform(streamReader);
|
||||
return streamReader == newReader ? original : new ReaderInputStream(newReader);
|
||||
}
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package org.jetbrains.jps.incremental.groovy;
|
||||
|
||||
@@ -37,6 +23,7 @@ import org.jetbrains.jps.model.library.sdk.JpsSdk;
|
||||
import org.jetbrains.jps.model.module.JpsModule;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -265,7 +252,7 @@ public class GroovycOutputParser {
|
||||
String classpath) throws IOException {
|
||||
File tempFile = FileUtil.createTempFile("ideaGroovyToCompile", ".txt", true);
|
||||
|
||||
final Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile)));
|
||||
final Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), StandardCharsets.UTF_8));
|
||||
try {
|
||||
writer.write(classpath);
|
||||
writer.write("\n");
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
@@ -198,7 +199,7 @@ public class MvcConsole implements Disposable {
|
||||
final String... input) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
assert module.getProject() == myProject;
|
||||
|
||||
|
||||
final MyProcessInConsole process = new MyProcessInConsole(module, commandLine, onDone, showConsole, closeOnDone, input);
|
||||
if (isExecuting()) {
|
||||
myProcessQueue.add(process);
|
||||
@@ -241,7 +242,7 @@ public class MvcConsole implements Disposable {
|
||||
handler = new OSProcessHandler(commandLine);
|
||||
|
||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
||||
OutputStreamWriter writer = new OutputStreamWriter(handler.getProcess().getOutputStream());
|
||||
OutputStreamWriter writer = new OutputStreamWriter(handler.getProcess().getOutputStream(), StandardCharsets.UTF_8);
|
||||
for (String s : input) {
|
||||
writer.write(s);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.zmlx.hg4idea.execution;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -14,6 +14,7 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
public class HgPromptCommandExecutor extends HgCommandExecutor {
|
||||
@@ -67,11 +68,11 @@ public class HgPromptCommandExecutor extends HgCommandExecutor {
|
||||
//noinspection IOResourceOpenedButNotSafelyClosed
|
||||
DataInputStream dataInput = new DataInputStream(socket.getInputStream());
|
||||
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
|
||||
final String message = new String(readDataBlock(dataInput));
|
||||
final String message = new String(readDataBlock(dataInput), StandardCharsets.UTF_8);
|
||||
int numOfChoices = dataInput.readInt();
|
||||
final HgPromptChoice[] choices = new HgPromptChoice[numOfChoices];
|
||||
for (int i = 0; i < numOfChoices; i++) {
|
||||
String choice = new String(readDataBlock(dataInput));
|
||||
String choice = new String(readDataBlock(dataInput), StandardCharsets.UTF_8);
|
||||
choices[i] = new HgPromptChoice(i, choice);
|
||||
}
|
||||
int defaultChoiceInt = dataInput.readInt();
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
public class HgRemoteCommandExecutor extends HgCommandExecutor {
|
||||
@@ -128,18 +129,18 @@ public class HgRemoteCommandExecutor extends HgCommandExecutor {
|
||||
DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());
|
||||
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
|
||||
|
||||
String command = new String(readDataBlock(dataInputStream));
|
||||
String command = new String(readDataBlock(dataInputStream), StandardCharsets.UTF_8);
|
||||
assert "getpass".equals(command) : "Invalid command: " + command;
|
||||
String uri = new String(readDataBlock(dataInputStream));
|
||||
String path = new String(readDataBlock(dataInputStream));
|
||||
String proposedLogin = new String(readDataBlock(dataInputStream));
|
||||
String uri = new String(readDataBlock(dataInputStream), StandardCharsets.UTF_8);
|
||||
String path = new String(readDataBlock(dataInputStream), StandardCharsets.UTF_8);
|
||||
String proposedLogin = new String(readDataBlock(dataInputStream), StandardCharsets.UTF_8);
|
||||
|
||||
HgCommandAuthenticator authenticator = new HgCommandAuthenticator(myForceAuthorization, mySilentMode);
|
||||
boolean ok = authenticator.promptForAuthentication(myProject, proposedLogin, uri, path, myState);
|
||||
if (ok) {
|
||||
myAuthenticator = authenticator;
|
||||
sendDataBlock(out, authenticator.getUserName().getBytes());
|
||||
sendDataBlock(out, authenticator.getPassword().getBytes());
|
||||
sendDataBlock(out, authenticator.getUserName().getBytes(StandardCharsets.UTF_8));
|
||||
sendDataBlock(out, authenticator.getPassword().getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package hg4idea.test;
|
||||
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
@@ -27,6 +13,7 @@ import org.zmlx.hg4idea.repo.HgRepositoryImpl;
|
||||
import org.zmlx.hg4idea.util.HgEncodingUtil;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.vcs.Executor.cd;
|
||||
@@ -62,6 +49,6 @@ public class HgEncodingTest extends HgPlatformTest {
|
||||
assert file != null;
|
||||
List<HgFileRevision> revisions = logCommand.execute(new HgFile(myProject, file), 1, false);
|
||||
HgFileRevision rev = revisions.get(0);
|
||||
assertEquals(new String(comment.getBytes(charset)), rev.getCommitMessage());
|
||||
assertEquals(new String(comment.getBytes(charset), StandardCharsets.UTF_8), rev.getCommitMessage());
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.javaFX.fxml;
|
||||
|
||||
import javafx.application.Application;
|
||||
@@ -21,6 +22,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -496,7 +498,7 @@ public class JavaFxGenerateDefaultPropertyValuesScript extends Application {
|
||||
StringBuilder text = new StringBuilder();
|
||||
int len;
|
||||
while ((len = zip.read(buffer)) > 0) {
|
||||
String str = new String(buffer, 0, len);
|
||||
String str = new String(buffer, 0, len, StandardCharsets.UTF_8);
|
||||
text.append(str);
|
||||
}
|
||||
String[] lines = text.toString().split("\n");
|
||||
|
||||
+10
-23
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.junit;
|
||||
|
||||
import com.intellij.junit4.JUnit4TestListener;
|
||||
@@ -27,6 +13,7 @@ import org.junit.runner.notification.Failure;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -128,7 +115,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
JUnit4TestListener sender = createListener(buf);
|
||||
|
||||
|
||||
sender.testRunStarted(root);
|
||||
for (Description test : tests) {
|
||||
sender.testStarted(test);
|
||||
@@ -223,7 +210,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='|[1|]']\n");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testParameterizedClassWithSameParameters() throws Exception {
|
||||
final String className = "a.TestA";
|
||||
@@ -393,7 +380,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
root.addChild(testA);
|
||||
final Description testName = Description.createTestDescription("TestA", "testName");
|
||||
testA.addChild(testName);
|
||||
|
||||
|
||||
final Description testB = Description.createSuiteDescription("TestB");
|
||||
root.addChild(testB);
|
||||
final Description testNameB = Description.createTestDescription("TestB", "testNameB");
|
||||
@@ -604,7 +591,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='TestA']\n", StringUtil.convertLineSeparators(buf.toString()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTearDownClassFailureSingleClass() throws Exception {
|
||||
final Description testA = Description.createSuiteDescription("TestA");
|
||||
@@ -697,7 +684,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
Assert.assertEquals("output: " + buf, "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testIgnored name='TestA.testName' error='true' message='' details='java.lang.Exception|n']\n", StringUtil.convertLineSeparators(buf.toString()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -826,7 +813,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
final JUnit4TestListener sender = createListener(buf);
|
||||
|
||||
|
||||
sender.testRunStarted(root);
|
||||
for (Description test : tests) {
|
||||
sender.testStarted(test);
|
||||
@@ -857,7 +844,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
return new JUnit4TestListener(new PrintStream(new OutputStream() {
|
||||
@Override
|
||||
public void write(int b) {
|
||||
buf.append(new String(new byte[]{(byte)b}));
|
||||
buf.append(new String(new byte[]{(byte)b}, StandardCharsets.UTF_8));
|
||||
}
|
||||
})) {
|
||||
@Override
|
||||
@@ -984,7 +971,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
param1.addChild(testDescription);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void doTest(Description description, String expected) {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
createListener(buf).sendTree(description);
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.jps.maven.compiler;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -32,6 +18,7 @@ import org.jetbrains.jps.model.JpsEncodingProjectConfiguration;
|
||||
import org.jetbrains.jps.model.JpsProject;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -97,7 +84,7 @@ public class MavenResourceFileProcessor {
|
||||
}
|
||||
try {
|
||||
final byte[] bytes = FileUtil.loadFileBytes(file);
|
||||
final String text = encoding != null? new String(bytes, encoding) : new String(bytes);
|
||||
final String text = encoding != null? new String(bytes, encoding) : new String(bytes, StandardCharsets.UTF_8);
|
||||
doFilterText(text, getDelimitersPattern(), getProperties(), null, writer);
|
||||
}
|
||||
finally {
|
||||
|
||||
+2
-1
@@ -65,6 +65,7 @@ import org.jetbrains.idea.maven.utils.MavenUtil;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.idea.maven.server.MavenServerManager.verifyMavenSdkRequirements;
|
||||
@@ -187,7 +188,7 @@ public class MavenExternalParameters {
|
||||
Scanner sc = new Scanner(originalConf);
|
||||
|
||||
try {
|
||||
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dest)));
|
||||
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dest), StandardCharsets.UTF_8));
|
||||
|
||||
try {
|
||||
boolean patched = false;
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.maven.vfs;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -24,6 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
@@ -50,7 +37,7 @@ public class MavenPropertiesVirtualFile extends VirtualFile {
|
||||
builder.append(StringUtil.escapeProperty(properties.getProperty(each), false));
|
||||
builder.append("\n");
|
||||
}
|
||||
return builder.toString().getBytes();
|
||||
return builder.toString().getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.maven.project;
|
||||
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
@@ -80,7 +66,8 @@ public class MavenProjectReaderTest extends MavenTestCase {
|
||||
|
||||
assertProblems(readProject(myProjectPom, new NullProjectLocator()));
|
||||
|
||||
createProjectPom("<name>a" + new String(new byte[]{0x0}) + "a</name><fo" + new String(new byte[]{0x0}) + "o></foo>");
|
||||
createProjectPom("<name>a" + new String(new byte[]{0x0}, StandardCharsets.UTF_8) + "a</name><fo" + new String(new byte[]{0x0},
|
||||
StandardCharsets.UTF_8) + "o></foo>");
|
||||
|
||||
MavenProjectReaderResult result = readProject(myProjectPom, new NullProjectLocator());
|
||||
assertProblems(result, "'pom.xml' has syntax errors");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.svn.commandLine;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
@@ -25,6 +25,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -116,7 +117,7 @@ public class CommandExecutor {
|
||||
beforeCreateProcess();
|
||||
myProcess = createProcess();
|
||||
myHandler = createProcessHandler();
|
||||
myProcessWriter = new OutputStreamWriter(myHandler.getProcessInput());
|
||||
myProcessWriter = new OutputStreamWriter(myHandler.getProcessInput(), StandardCharsets.UTF_8);
|
||||
startHandlingStreams();
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
|
||||
+3
-3
@@ -63,7 +63,7 @@ public class SearchingForTestsTask extends SearchForTestsTask {
|
||||
}
|
||||
|
||||
try {
|
||||
FileUtil.writeToFile(myTempFile, "end".getBytes(), true);
|
||||
FileUtil.writeToFile(myTempFile, "end".getBytes(StandardCharsets.UTF_8), true);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
@@ -80,7 +80,7 @@ public class SearchingForTestsTask extends SearchForTestsTask {
|
||||
protected void logCantRunException(ExecutionException e) {
|
||||
try {
|
||||
final String message = "CantRunException" + e.getMessage() + "\n";
|
||||
FileUtil.writeToFile(myTempFile, message.getBytes());
|
||||
FileUtil.writeToFile(myTempFile, message.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
catch (IOException e1) {
|
||||
LOG.error(e1);
|
||||
@@ -118,7 +118,7 @@ public class SearchingForTestsTask extends SearchForTestsTask {
|
||||
int logLevel = 1;
|
||||
try {
|
||||
final Properties properties = new Properties();
|
||||
properties.load(new ByteArrayInputStream(myConfig.getVMParameters().getBytes()));
|
||||
properties.load(new ByteArrayInputStream(myConfig.getVMParameters().getBytes(StandardCharsets.UTF_8)));
|
||||
final String verbose = properties.getProperty("-Dtestng.verbose");
|
||||
if (verbose != null) {
|
||||
logLevel = Integer.parseInt(verbose);
|
||||
|
||||
+6
-19
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.theoryinpractice.testng.configuration;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -30,12 +16,13 @@ import org.testng.xml.XmlTest;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class TestNGTreeHierarchyTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testOneTestMethod() {
|
||||
final XmlSuite suite = new XmlSuite();
|
||||
@@ -44,7 +31,7 @@ public class TestNGTreeHierarchyTest {
|
||||
xmlClass.getIncludedMethods().add(new XmlInclude("test1"));
|
||||
test.getClasses().add(xmlClass);
|
||||
suite.getTests().add(test);
|
||||
|
||||
|
||||
doTest(suite,"##teamcity[enteredTheMatrix]\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
|
||||
@@ -276,7 +263,7 @@ public class TestNGTreeHierarchyTest {
|
||||
"##teamcity[testFinished name='ATest.setUp']\n" +
|
||||
"##teamcity[testSuiteFinished name='a.ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAfterMethodWithInjectedTestResult() {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
@@ -384,7 +371,7 @@ public class TestNGTreeHierarchyTest {
|
||||
return new IDEATestNGRemoteListener(new PrintStream(new OutputStream() {
|
||||
@Override
|
||||
public void write(int b) {
|
||||
buf.append(new String(new byte[]{(byte)b}));
|
||||
buf.append(new String(new byte[]{(byte)b}, StandardCharsets.UTF_8));
|
||||
}
|
||||
})) {
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.debugger;
|
||||
|
||||
import com.jetbrains.python.console.pydev.AbstractPyCodeCompletion;
|
||||
@@ -13,6 +13,7 @@ import javax.xml.parsers.SAXParserFactory;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -139,7 +140,7 @@ public class PydevXmlUtils {
|
||||
public static List<PydevCompletionVariant> xmlToCompletions(String payload, String actionToken) throws Exception {
|
||||
SAXParser parser = getSAXParser();
|
||||
XMLToCompletionsInfo info = new XMLToCompletionsInfo();
|
||||
parser.parse(new ByteArrayInputStream(payload.getBytes()), info);
|
||||
parser.parse(new ByteArrayInputStream(payload.getBytes(StandardCharsets.UTF_8)), info);
|
||||
return decodeCompletions(info.getCompletions(), actionToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.codeInsight.stdlib;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -23,6 +9,7 @@ import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -46,7 +33,7 @@ public class PyStdlibUtil {
|
||||
final Logger log = Logger.getInstance(PyStdlibUtil.class.getName());
|
||||
final String helperPath = PythonHelpersLocator.getHelperPath("/tools/stdlib_packages.txt");
|
||||
try {
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(helperPath)));
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(helperPath), StandardCharsets.UTF_8));
|
||||
try {
|
||||
final Set<String> result = new HashSet<>();
|
||||
String line;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.debugger;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -119,7 +120,7 @@ public class PySignatureCacheManagerImpl extends PySignatureCacheManager {
|
||||
|
||||
private static void writeAttributeToAFile(@NotNull VirtualFile file, @NotNull String attrString) {
|
||||
try {
|
||||
CALL_SIGNATURES_ATTRIBUTE.writeAttributeBytes(file, attrString.getBytes());
|
||||
CALL_SIGNATURES_ATTRIBUTE.writeAttributeBytes(file, attrString.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.warn("Can't write attribute " + file.getCanonicalPath() + " " + attrString);
|
||||
@@ -206,7 +207,7 @@ public class PySignatureCacheManagerImpl extends PySignatureCacheManager {
|
||||
|
||||
String content;
|
||||
if (data != null && data.length > 0) {
|
||||
content = new String(data);
|
||||
content = new String(data, StandardCharsets.UTF_8);
|
||||
}
|
||||
else {
|
||||
content = null;
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.validation;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -72,6 +58,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -229,7 +216,7 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
|
||||
ProcessOutput output = PySdkUtil.getProcessOutput(cmd, new File(collectedInfo.interpreterPath).getParent(),
|
||||
ImmutableMap.of("PYTHONBUFFERED", "1"),
|
||||
10000,
|
||||
collectedInfo.fileText.getBytes(), false);
|
||||
collectedInfo.fileText.getBytes(StandardCharsets.UTF_8), false);
|
||||
|
||||
Results results = new Results(collectedInfo.level);
|
||||
if (output.isTimeout()) {
|
||||
@@ -286,7 +273,7 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
|
||||
problemElement.getParent() instanceof PyAnnotation) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
TextRange problemRange = problemElement.getTextRange();
|
||||
// Multi-line warnings are shown only in the gutter and it's not the desired behavior from the usability point of view.
|
||||
// So we register it only on that line where pycodestyle.py found the problem originally.
|
||||
@@ -362,7 +349,7 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
|
||||
|
||||
final CommonCodeStyleSettings commonSettings = CodeStyle.getLanguageSettings(file, PythonLanguage.getInstance());
|
||||
final PyCodeStyleSettings pySettings = CodeStyle.getCustomSettings(file, PyCodeStyleSettings.class);
|
||||
|
||||
|
||||
if (element instanceof PsiWhiteSpace) {
|
||||
// E303 too many blank lines (num)
|
||||
if (problem.myCode.equals("E303")) {
|
||||
@@ -391,14 +378,14 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
|
||||
}
|
||||
|
||||
// E251 unexpected spaces around keyword / parameter equals
|
||||
// Note that E222 (multiple spaces after operator) is not suppressed, though.
|
||||
// Note that E222 (multiple spaces after operator) is not suppressed, though.
|
||||
if (problem.myCode.equals("E251") &&
|
||||
(element.getParent() instanceof PyParameter && pySettings.SPACE_AROUND_EQ_IN_NAMED_PARAMETER ||
|
||||
element.getParent() instanceof PyKeywordArgument && pySettings.SPACE_AROUND_EQ_IN_KEYWORD_ARGUMENT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// W191 (indentation contains tabs) is reported also for indents inside multiline string literals,
|
||||
// W191 (indentation contains tabs) is reported also for indents inside multiline string literals,
|
||||
// thus underlying PSI element is not necessarily a whitespace
|
||||
if (problem.myCode.equals("W191") && CodeStyle.getIndentOptions(file).USE_TAB_CHARACTER) {
|
||||
return true;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.updater;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarInputStream;
|
||||
@@ -115,7 +116,7 @@ public class Bootstrap {
|
||||
private static List<File> readDependenciesTxt(String basePath, URL dependenciesTxtUrl) throws Exception {
|
||||
List<File> files = new ArrayList<>();
|
||||
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(dependenciesTxtUrl.openStream()))) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(dependenciesTxtUrl.openStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
File file = new File(basePath + line);
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -38,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -226,10 +213,10 @@ public class Xsd2InstanceUtils {
|
||||
bytes = content.getBytes(virtualFile.getCharset());
|
||||
} else {
|
||||
try {
|
||||
final String charsetName = XmlUtil.extractXmlEncodingFromProlog(content.getBytes());
|
||||
bytes = charsetName != null ? content.getBytes(charsetName) : content.getBytes();
|
||||
final String charsetName = XmlUtil.extractXmlEncodingFromProlog(content.getBytes(StandardCharsets.UTF_8));
|
||||
bytes = charsetName != null ? content.getBytes(charsetName) : content.getBytes(StandardCharsets.UTF_8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
bytes = content.getBytes();
|
||||
bytes = content.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.xml.index;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -12,6 +13,7 @@ import com.intellij.util.io.DataExternalizer;
|
||||
import com.intellij.xml.util.XmlUtil;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -42,7 +44,8 @@ public class XmlSchemaIndexTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testXsdNamespaceBuilder() throws Exception {
|
||||
VirtualFile file = myFixture.copyFileToProject("web-app_2_5.xsd");
|
||||
final XsdNamespaceBuilder builder = XsdNamespaceBuilder.computeNamespace(new InputStreamReader(file.getInputStream()));
|
||||
final XsdNamespaceBuilder builder = XsdNamespaceBuilder.computeNamespace(new InputStreamReader(file.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
assertEquals(NS, builder.getNamespace());
|
||||
assertEquals("2.5", builder.getVersion());
|
||||
assertEquals(Collections.singletonList("web-app"), builder.getTags());
|
||||
@@ -50,7 +53,8 @@ public class XmlSchemaIndexTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testRootTags() throws Exception {
|
||||
VirtualFile file = myFixture.copyFileToProject("XMLSchema.xsd");
|
||||
final XsdNamespaceBuilder builder = XsdNamespaceBuilder.computeNamespace(new InputStreamReader(file.getInputStream()));
|
||||
final XsdNamespaceBuilder builder = XsdNamespaceBuilder.computeNamespace(new InputStreamReader(file.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
assertEquals(XmlUtil.XML_SCHEMA_URI, builder.getNamespace());
|
||||
assertEquals("1.0", builder.getVersion());
|
||||
assertEquals(Collections.singletonList("schema"), builder.getRootTags());
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
public class XsdComplexTypeInfoBuilder implements NanoXmlBuilder {
|
||||
@@ -26,7 +27,7 @@ public class XsdComplexTypeInfoBuilder implements NanoXmlBuilder {
|
||||
}
|
||||
|
||||
public static MultiMap<SchemaTypeInfo, SchemaTypeInfo> parse(final InputStream is) {
|
||||
return parse(new InputStreamReader(is));
|
||||
return parse(new InputStreamReader(is, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public static MultiMap<SchemaTypeInfo, SchemaTypeInfo> parse(@NotNull Reader reader) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -24,7 +25,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class XsdNamespaceBuilder implements Comparable<XsdNamespaceBuilder>, NanoXmlBuilder {
|
||||
public static String computeNamespace(final InputStream is) {
|
||||
return computeNamespace(new InputStreamReader(is)).getNamespace();
|
||||
return computeNamespace(new InputStreamReader(is, StandardCharsets.UTF_8)).getNamespace();
|
||||
}
|
||||
|
||||
public static XsdNamespaceBuilder computeNamespace(@NotNull Reader reader) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -20,7 +21,7 @@ import java.util.Collection;
|
||||
public class XsdTagNameBuilder implements NanoXmlBuilder {
|
||||
@NotNull
|
||||
public static Collection<String> computeTagNames(final InputStream is) {
|
||||
return computeTagNames(new InputStreamReader(is));
|
||||
return computeTagNames(new InputStreamReader(is, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user