Improve exception mechanics. remove closure of stream.

Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
Emmanuel Bigeon 2018-11-25 00:27:30 -05:00
parent b9a7142c5c
commit 6993513f38

View File

@ -80,17 +80,18 @@ public final class ForwardingRunnable implements Runnable {
public void run() { public void run() {
try { try {
readToEnd(); readToEnd();
is.close();
} catch (final CommandRunException e) { } catch (final CommandRunException e) {
LOGGER.log(Level.WARNING, "Manager was closed in the meantime...", e); //$NON-NLS-1$ LOGGER.log(Level.WARNING, "Manager was closed in the meantime...", e); //$NON-NLS-1$
setError(e); setError(e);
} catch (final IOException e) {
LOGGER.log(Level.WARNING, "Input stream was closed...", e); //$NON-NLS-1$
setError(e);
} }
} }
/** Read the input until its end. /** Read the input until its end.
* <p>
* This method actually perform a loop on the input stream to read the next
* character and then print int on the screen.
* <p>
* When the stream returns a negative value, it will exit its loop and return.
* *
* @throws CommandRunException if the manager was closed while writing the * @throws CommandRunException if the manager was closed while writing the
* stream */ * stream */