mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-02 09:11:29 +01:00
Handle and report exception thrown by checkstyle
Change-Id: I041fd0d4787ddff80a206e47688524984f3500ff
This commit is contained in:
parent
e6067899ad
commit
8df94b8f23
@ -21,6 +21,7 @@ import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
|
||||
import org.onosproject.checkstyle.CheckstyleRunner;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -176,9 +177,14 @@ public final class BuckDaemon {
|
||||
BuckTask task = tasks.get(taskName);
|
||||
if (task != null) {
|
||||
System.out.println(String.format("Executing task '%s'", taskName));
|
||||
task.execute(context);
|
||||
for (String line : context.output()) {
|
||||
output(socket, line);
|
||||
try {
|
||||
task.execute(context);
|
||||
for (String line : context.output()) {
|
||||
output(socket, line);
|
||||
}
|
||||
// TODO should we catch Exception, RuntimeException, or something specific?
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace(new PrintStream(socket.getOutputStream()));
|
||||
}
|
||||
} else {
|
||||
String message = String.format("No task named '%s'", taskName);
|
||||
|
||||
@ -91,6 +91,7 @@ public class CheckstyleRunner implements BuckTask {
|
||||
|
||||
listener.await();
|
||||
} catch (CheckstyleException | InterruptedException e) {
|
||||
e.printStackTrace(); //dump exeception to stderr
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
checker.destroy();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user