do not print trace for compilation-canceled exception

This commit is contained in:
Eugene Zhuravlev
2012-04-02 20:20:24 +02:00
parent f6f3db8a5a
commit c3d0b3a5cd
3 changed files with 20 additions and 6 deletions
@@ -0,0 +1,16 @@
package org.jetbrains.jps.javac;
/**
* @author Eugene Zhuravlev
* Date: 4/2/12
*/
class CompilationCanceledException extends RuntimeException{
CompilationCanceledException() {
super("Compilation canceled");
}
@Override
public synchronized Throwable fillInStackTrace() {
return this;
}
}
@@ -210,12 +210,7 @@ class JavacFileManager extends ForwardingJavaFileManager<StandardJavaFileManager
final int counter = (myChecksCounter + 1) % 10;
myChecksCounter = counter;
if (counter == 0 && myContext.isCanceled()) {
throw new RuntimeException("Compilation canceled") {
@Override
public Throwable fillInStackTrace() {
return this;
}
};
throw new CompilationCanceledException();
}
}
}
@@ -140,6 +140,9 @@ public class JavacServer {
final boolean rc = JavacMain.compile(options, files, classpath, platformCp, sourcePath, outs, diagnostic, outputSink, canceledStatus);
return JavacProtoUtil.toMessage(sessionId, JavacProtoUtil.createBuildCompletedResponse(rc));
}
catch (CompilationCanceledException e) {
return JavacProtoUtil.toMessage(sessionId, JavacProtoUtil.createFailure(e.getMessage(), e));
}
catch (Throwable e) {
e.printStackTrace(System.err);
return JavacProtoUtil.toMessage(sessionId, JavacProtoUtil.createFailure(e.getMessage(), e));