mirror of
				https://github.com/opennetworkinglab/onos.git
				synced 2025-11-04 10:11:16 +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,9 +177,14 @@ 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));
 | 
				
			||||||
                        task.execute(context);
 | 
					                        try {
 | 
				
			||||||
                        for (String line : context.output()) {
 | 
					                            task.execute(context);
 | 
				
			||||||
                            output(socket, line);
 | 
					                            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 {
 | 
					                    } else {
 | 
				
			||||||
                        String message = String.format("No task named '%s'", taskName);
 | 
					                        String message = String.format("No task named '%s'", taskName);
 | 
				
			||||||
 | 
				
			|||||||
@ -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