mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] uses platform encoding for 'javadoc' @arg file and console (IDEA-202849)
This commit is contained in:
@@ -31,16 +31,15 @@ import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
@@ -220,8 +219,9 @@ public class JavadocGeneratorRunProfile implements ModuleRunProfile {
|
||||
|
||||
try {
|
||||
File argsFile = FileUtil.createTempFile("javadoc_args", null);
|
||||
Charset cs = CharsetToolkit.getPlatformCharset();
|
||||
|
||||
try (PrintWriter writer = new PrintWriter(new FileWriter(argsFile))) {
|
||||
try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(argsFile), cs))) {
|
||||
Set<Module> modules = new LinkedHashSet<>();
|
||||
Set<VirtualFile> sources = new HashSet<>();
|
||||
Runnable r = () -> myGenerationOptions.accept(new MyContentIterator(myProject, modules, sources));
|
||||
@@ -285,9 +285,10 @@ public class JavadocGeneratorRunProfile implements ModuleRunProfile {
|
||||
}
|
||||
}
|
||||
|
||||
myArgFileFilter.setPath(argsFile.getPath());
|
||||
myArgFileFilter.setPath(argsFile.getPath(), cs);
|
||||
parameters.add("@" + argsFile.getPath());
|
||||
OSProcessHandler.deleteFileOnTermination(cmdLine, argsFile);
|
||||
cmdLine.setCharset(cs);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new CantRunException(JavadocBundle.message("javadoc.generate.temp.file.error"), e);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2017 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-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.
|
||||
package com.intellij.execution.filters
|
||||
|
||||
import java.io.File
|
||||
import java.nio.charset.Charset
|
||||
|
||||
/**
|
||||
* A console filter which looks for a given path in an output and creates a link for viewing a content of that file.
|
||||
@@ -16,9 +17,10 @@ class ArgumentFileFilter() : Filter {
|
||||
this.fileText = fileText
|
||||
}
|
||||
|
||||
fun setPath(path: String) {
|
||||
@JvmOverloads
|
||||
fun setPath(path: String, charset: Charset = Charsets.UTF_8) {
|
||||
filePath = path
|
||||
fileText = File(path).readText()
|
||||
fileText = File(path).readText(charset)
|
||||
}
|
||||
|
||||
override fun applyFilter(line: String, entireLength: Int): Filter.Result? {
|
||||
|
||||
Reference in New Issue
Block a user