mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-05 18:51:25 +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 org.onosproject.checkstyle.CheckstyleRunner;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
@ -176,10 +177,15 @@ public final class BuckDaemon {
|
|||||||
BuckTask task = tasks.get(taskName);
|
BuckTask task = tasks.get(taskName);
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
System.out.println(String.format("Executing task '%s'", taskName));
|
System.out.println(String.format("Executing task '%s'", taskName));
|
||||||
|
try {
|
||||||
task.execute(context);
|
task.execute(context);
|
||||||
for (String line : context.output()) {
|
for (String line : context.output()) {
|
||||||
output(socket, line);
|
output(socket, line);
|
||||||
}
|
}
|
||||||
|
// TODO should we catch Exception, RuntimeException, or something specific?
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace(new PrintStream(socket.getOutputStream()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
String message = String.format("No task named '%s'", taskName);
|
String message = String.format("No task named '%s'", taskName);
|
||||||
System.out.print(message);
|
System.out.print(message);
|
||||||
|
|||||||
@ -91,6 +91,7 @@ public class CheckstyleRunner implements BuckTask {
|
|||||||
|
|
||||||
listener.await();
|
listener.await();
|
||||||
} catch (CheckstyleException | InterruptedException e) {
|
} catch (CheckstyleException | InterruptedException e) {
|
||||||
|
e.printStackTrace(); //dump exeception to stderr
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
checker.destroy();
|
checker.destroy();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user