ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 62148] NullPointerException in PumpStreamHandler
Date Thu, 01 Mar 2018 17:08:10 GMT

Stefan Bodewig <> changed:

           What    |Removed                     |Added
                 OS|                            |All

--- Comment #1 from Stefan Bodewig <> ---
If you look through Ant's code, you will see PumpStreamHandler is only ever
used from within Execute (apart from invoking the constructor which happens in
a few different places) and inside of this context we "know" outputThread can
never be null. All three setProcess*Stream methods will have been called in
either case before start is called.

Actually technically there may even be a bug that errorThread could be null,
but this doesn't seem to happen in practice or we would have bug reports. The
"err != null" check in setProcessErrorStream looks wrong, neither out nor err
are allowed to be null or we'd end up with NPEs in stop - and in the case of
err == null would  not consume a process' error stream which may block the
process eventually.

The class is not designed to be used outside of the context if Execute at all.
It is public for technical reasons but not expected to be used as an public
API. I hope you are writing a test because you "just" want to write a test and
not because you want to re-use the class outside of Ant.

That being said it certainly wouldn't hurt if the code was more defensive and
verified the implicit preconditions.

You are receiving this mail because:
You are the assignee for the bug.
View raw message