The first patch is short and seems correct, the second a bit large to digest so quickly.
The idea of a generic inputstream with a timeout is cool. (Although, I wonder, don't we have it already somewhere? Or in some library?) > I also suppose that we want to keep the java 6 level. We can go all the way to Java 8, no need to remain at Java 6. I guess the existing code is just old(er). Please make a GitHub PR, it might be simpler to receive feedback. --emi -------- Original Message -------- On 15 February 2018 4:42 PM, Basin Ilya <[email protected]> wrote: >Here's the proposed patch. > Changed lines formatted with Netbeans 8.2 default formatter. Copyright header > not added to the new file. > >>Hi. >> In case of wrong setup a cvs log command may print nothing. This makes the >> LoggedDataInputStream#read() method in the Netbeans CVS client loop forever. >> See this SO >> question for details: >>https://stackoverflow.com/questions/48741854/inputstream-wrapper-with-actual-read-in-a-dedicated-thread >>There's a bug mentioning sleep() inside LoggedDataInputStream: >>https://netbeans.org/bugzilla/show_bug.cgi?id=254761 >>There are two types of input streams the LoggedDataInputStream works with. If >>it's a server connection, the stream is a SocketInputStream. If it's a local >>connection, the >> stream is a read side of a pipe returned by Process.getInputStream(). >>I suppose that we want to keep the Thread.interrupted() check in >>LoggedDataInputStream, but using available() is definitely not the right way >>to check for premature EOF. >> I also suppose that we want to keep the java 6 level. >>I want to but remove the sleep() and available() calls from >>LoggedDataInputStream and instead catch the SocketTimeoutException and check >>the interrupted status on a timeout. >>In case of a socket we will set the socket timeout to 100ms. >> In case of a pipe we will perform reading in a dedicated thread. See the SO >> question above. >> > > > >To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > For further information about the NetBeans mailing lists, visit: >https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
