mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
fix incomplete output parsing by compiler parsing thread
This commit is contained in:
+38
-40
@@ -27,8 +27,6 @@ import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -50,7 +48,7 @@ public class CompilerParsingThread implements Runnable, OutputParser.Callback {
|
||||
private volatile boolean myProcessExited = false;
|
||||
private final CompileContext myContext;
|
||||
|
||||
private final BlockingQueue<String> myLines = new LinkedBlockingQueue<String>();
|
||||
//private final BlockingQueue<String> myLines = new LinkedBlockingQueue<String>();
|
||||
|
||||
public CompilerParsingThread(Process process, OutputParser outputParser, final boolean readErrorStream, boolean trimLines, CompileContext context) {
|
||||
myProcess = process;
|
||||
@@ -64,31 +62,31 @@ public class CompilerParsingThread implements Runnable, OutputParser.Callback {
|
||||
|
||||
volatile boolean processing;
|
||||
public void run() {
|
||||
if (CompileDriver.ourDebugMode) {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
final String line = readLine(myCompilerOutStreamReader);
|
||||
if (CompileDriver.ourDebugMode) {
|
||||
System.out.println("RAW_LIne read: #" + line + "#");
|
||||
}
|
||||
if (line == null) {
|
||||
myLines.offer(TERMINATION_STRING);
|
||||
break;
|
||||
}
|
||||
myLines.offer(line);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//if (CompileDriver.ourDebugMode) {
|
||||
// ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// while (true) {
|
||||
// final String line = readLine(myCompilerOutStreamReader);
|
||||
// if (CompileDriver.ourDebugMode) {
|
||||
// System.out.println("RAW_LIne read: #" + line + "#");
|
||||
// }
|
||||
// if (line == null) {
|
||||
// myLines.offer(TERMINATION_STRING);
|
||||
// break;
|
||||
// }
|
||||
// myLines.offer(line);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
processing = true;
|
||||
try {
|
||||
while (true) {
|
||||
if (!myIsUnitTestMode && myProcess == null) {
|
||||
break;
|
||||
}
|
||||
if (myProcessExited || isCanceled()) {
|
||||
if (isCanceled()) {
|
||||
break;
|
||||
}
|
||||
if (!myOutputParser.processMessageLine(this)) {
|
||||
@@ -150,25 +148,25 @@ public class CompilerParsingThread implements Runnable, OutputParser.Callback {
|
||||
}
|
||||
|
||||
private String getNextUnprocessedLine() {
|
||||
if (CompileDriver.ourDebugMode) {
|
||||
try {
|
||||
if (TERMINATION_STRING.equals(myLines.peek())) {
|
||||
return TERMINATION_STRING;
|
||||
}
|
||||
final String line = myLines.take();
|
||||
if (TERMINATION_STRING.equals(line)) {
|
||||
myLines.offer(TERMINATION_STRING); // pushback
|
||||
}
|
||||
return line;
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return TERMINATION_STRING;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//if (CompileDriver.ourDebugMode) {
|
||||
// try {
|
||||
// if (TERMINATION_STRING.equals(myLines.peek())) {
|
||||
// return TERMINATION_STRING;
|
||||
// }
|
||||
// final String line = myLines.take();
|
||||
// if (TERMINATION_STRING.equals(line)) {
|
||||
// myLines.offer(TERMINATION_STRING); // pushback
|
||||
// }
|
||||
// return line;
|
||||
// }
|
||||
// catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// return TERMINATION_STRING;
|
||||
// }
|
||||
//}
|
||||
//else {
|
||||
return readLine(myCompilerOutStreamReader);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user