mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
suspicious byte-to-string conversion using default encoding
This commit is contained in:
+4
-3
@@ -114,9 +114,9 @@ public class StorageUtil {
|
||||
final Ref<IOException> refIOException = Ref.create(null);
|
||||
|
||||
final Pair<String, String> pair = loadFile(LocalFileSystem.getInstance().findFileByIoFile(file));
|
||||
final byte[] text = JDOMUtil.writeParent(element, pair.second).getBytes(CharsetToolkit.UTF8);
|
||||
final String text = JDOMUtil.writeParent(element, pair.second);
|
||||
if (file.exists()) {
|
||||
if (new String(text).equals(pair.first)) return null;
|
||||
if (text.equals(pair.first)) return null;
|
||||
IFile backupFile = deleteBackup(filePath);
|
||||
file.renameTo(backupFile);
|
||||
}
|
||||
@@ -131,7 +131,8 @@ public class StorageUtil {
|
||||
try {
|
||||
final VirtualFile virtualFile = getOrCreateVirtualFile(requestor, file);
|
||||
|
||||
virtualFile.setBinaryContent(text, -1, -1, requestor);
|
||||
byte[] bytes = text.getBytes(CharsetToolkit.UTF8);
|
||||
virtualFile.setBinaryContent(bytes, -1, -1, requestor);
|
||||
result[0] = virtualFile;
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user