mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tests framework: do not write file if test doesn't contain output (IDEA-60642 )
This commit is contained in:
+13
-10
@@ -38,11 +38,7 @@ public class CompositePrintable implements Printable, Disposable {
|
||||
|
||||
public void flush() {
|
||||
if (myWrapper == null) {
|
||||
try {
|
||||
myWrapper = new PrintablesWrapper(FileUtil.createTempFile("frst", "scd"));
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
myWrapper = new PrintablesWrapper();
|
||||
}
|
||||
if (myWrapper != null) {
|
||||
synchronized (myNestedPrintables) {
|
||||
@@ -103,13 +99,19 @@ public class CompositePrintable implements Printable, Disposable {
|
||||
@NonNls private static final String HYPERLINK = "hyperlink";
|
||||
private DataInputStream myReader;
|
||||
private ConsoleViewContentType myLastSelected;
|
||||
private final File myFile;
|
||||
|
||||
PrintablesWrapper(File file) {
|
||||
myFile = file;
|
||||
}
|
||||
private File myFile;
|
||||
|
||||
public void flash(List<Printable> printables) {
|
||||
if (printables.isEmpty()) return;
|
||||
if (myFile == null) {
|
||||
try {
|
||||
myFile = FileUtil.createTempFile("frst", "scd");
|
||||
}
|
||||
catch (IOException e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final DataOutputStream fileWriter;
|
||||
try {
|
||||
fileWriter = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(myFile, true)));
|
||||
@@ -172,6 +174,7 @@ public class CompositePrintable implements Printable, Disposable {
|
||||
}
|
||||
|
||||
public void printOn(Printer console) {
|
||||
if (myFile == null || !myFile.exists()) return;
|
||||
try {
|
||||
myReader = new DataInputStream(new BufferedInputStream(new FileInputStream(myFile)));
|
||||
int lineNum = 0;
|
||||
@@ -219,7 +222,7 @@ public class CompositePrintable implements Printable, Disposable {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
FileUtil.delete(myFile);
|
||||
if (myFile != null) FileUtil.delete(myFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user