public void execute ( ) { try { Command command = new Parser ( ) . parse ( ) ; try { command . execute ( new ContextImpl ( ) , execute ) ; close ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Error while executing command " + command , e ) ; } catch ( AssertionError e ) { throw new RuntimeException ( "Error while executing command " + command , e ) ; } } finally { try { reader . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } writer . close ( ) ; try { close ( ) ; } catch ( SQLException e ) { // ignore } } }
Executes the commands from the input writing to the output then closing both input and output .