mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Standard Charset object used; other warnings fixed
This commit is contained in:
+8
-7
@@ -39,6 +39,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -874,22 +875,22 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
private static void printFailingSteps(List<Pair<RangeMarker, TextRange>> adds,
|
||||
List<Pair<RangeMarker, TextRange>> dels,
|
||||
List<Trinity<Integer, Integer, Integer>> edits) {
|
||||
String s = "adds: ";
|
||||
StringBuilder s = new StringBuilder("adds: ");
|
||||
for (Pair<RangeMarker, TextRange> c : adds) {
|
||||
TextRange t = c.second;
|
||||
s += t.getStartOffset() + "," + t.getEndOffset() + ", ";
|
||||
s.append(t.getStartOffset()).append(",").append(t.getEndOffset()).append(", ");
|
||||
}
|
||||
|
||||
s += "\nedits: ";
|
||||
s.append("\nedits: ");
|
||||
for (Trinity<Integer, Integer, Integer> edit : edits) {
|
||||
s += edit.first + "," + edit.second + "," + edit.third + ", ";
|
||||
s.append(edit.first).append(",").append(edit.second).append(",").append(edit.third).append(", ");
|
||||
}
|
||||
s += "\ndels: ";
|
||||
s.append("\ndels: ");
|
||||
|
||||
for (Pair<RangeMarker, TextRange> c : dels) {
|
||||
int index = adds.indexOf(c);
|
||||
assertSame(c, adds.get(index));
|
||||
s += index + ", ";
|
||||
s.append(index).append(", ");
|
||||
}
|
||||
System.err.println(s);
|
||||
}
|
||||
@@ -1374,7 +1375,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
|
||||
String newText = "0123blah";
|
||||
WriteCommandAction.runWriteCommandAction(getProject(), (ThrowableComputable<Object, IOException>)()->{
|
||||
vf.setBinaryContent(newText.getBytes("utf-8"));
|
||||
vf.setBinaryContent(newText.getBytes(StandardCharsets.UTF_8));
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
+6
-2
@@ -3,7 +3,10 @@ package com.intellij.xdebugger.attach.fs;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileListener;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.VirtualFileSystem;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.xdebugger.attach.EnvironmentAwareHost;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -12,6 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -129,6 +133,6 @@ public class LazyAttachVirtualFS extends VirtualFileSystem {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new String(FileUtil.loadBytes(stream), CharsetToolkit.UTF8);
|
||||
return new String(FileUtil.loadBytes(stream), StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
||||
@Override
|
||||
public void saveClassFile(String path, String qualifiedName, String entryName, String content, int[] mapping) {
|
||||
File file = new File(getAbsolutePath(path), entryName);
|
||||
try (Writer out = new OutputStreamWriter(new FileOutputStream(file), "UTF8")) {
|
||||
try (Writer out = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) {
|
||||
out.write(content);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class IpnbConnection {
|
||||
if (myXsrf == null) {
|
||||
initXSRF(myURI.toString() + USER_PATH + "/" + username + TREE_PATH);
|
||||
}
|
||||
final Boolean started = startJupyterNotebookServer(username);
|
||||
final boolean started = startJupyterNotebookServer(username);
|
||||
if (!started) {
|
||||
throw new IOException(CANNOT_START_JUPYTER);
|
||||
}
|
||||
@@ -469,8 +469,7 @@ public class IpnbConnection {
|
||||
|
||||
@NotNull
|
||||
private static String getResponse(HttpURLConnection connection) throws IOException {
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
|
||||
try {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
char[] buffer = new char[4096];
|
||||
int n;
|
||||
@@ -480,7 +479,6 @@ public class IpnbConnection {
|
||||
return builder.toString();
|
||||
}
|
||||
finally {
|
||||
reader.close();
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user