Re: Socket InputStream.available may return a positive value after shutdown
Jing LV wrote: Hello, I am using java.net.Socket and find an strange behaviour. If Socket inputstream is shutdown, and there was still some data remaining, its available() method may still return a positive value. I checked with the java spec, and the document of Socket.shutdownInput() said: "Places the input stream for this socket at "end of stream". Any data sent to the input stream side of the socket is acknowledged and then silently discarded. If you read from a socket input stream after invoking shutdownInput() on the socket, the stream will return EOF. " What's more, as I check inputStream.read(), it return a EOF, So I guess it would not be correct if available return a positive value. I agree this needs to be looked at and I've created a bug to track it: 7014860: Socket.getInputStream().available() not clear for case that connection is shutdown for reading (should be available on bugs.sun.com within 24h). As it stands the behavior is highly platform specific. Solaris's ioctl(FIONREAD) does return 0 when the connection has been shutdown for reading. Linux continues to return the number of bytes in the socket buffer, as does Windows. There may be alternative SocketImpls that do something different. Minimally, Socket#getInputStream and Socket#shutdownInput should be clarified to make it clear what the expected behavior is, even if is platform specific. -Alan
hg: jdk7/tl/jdk: 7012663: javadoc warning in javax.swing.JComponent and javax.swing.plaf.synth.SynthTextPaneUI
Changeset: bf1b937076db Author:alanb Date: 2011-01-26 18:01 + URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/bf1b937076db 7012663: javadoc warning in javax.swing.JComponent and javax.swing.plaf.synth.SynthTextPaneUI Reviewed-by: alexp ! src/share/classes/javax/swing/JComponent.java ! src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java
hg: jdk7/tl/langtools: 6554097: "final" confuses @SuppressWarnings
Changeset: df371fd16386 Author:jjg Date: 2011-01-26 11:20 -0800 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/df371fd16386 6554097: "final" confuses @SuppressWarnings Reviewed-by: mcimadamore ! src/share/classes/com/sun/tools/javac/code/Symbol.java ! src/share/classes/com/sun/tools/javac/comp/Attr.java ! src/share/classes/com/sun/tools/javac/comp/MemberEnter.java + test/tools/javac/T6554097.java + test/tools/javac/T6554097.out
hg: jdk7/tl/jdk: 7013420: Project Coin: remove general expression support from try-with-resources statement
Changeset: abab55565eda Author:darcy Date: 2011-01-26 12:32 -0800 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/abab55565eda 7013420: Project Coin: remove general expression support from try-with-resources statement Reviewed-by: alanb ! test/java/nio/channels/FileChannel/Truncate.java
hg: jdk7/tl/langtools: 7013272: Automatically generate info about how compiler resource keys are used
Changeset: 3da26790ccb7 Author:jjg Date: 2011-01-26 13:45 -0800 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/3da26790ccb7 7013272: Automatically generate info about how compiler resource keys are used Reviewed-by: mcimadamore ! make/build.xml ! src/share/classes/com/sun/tools/javac/code/Printer.java ! src/share/classes/com/sun/tools/javac/resources/compiler.properties + test/tools/javac/diags/ArgTypeCompilerFactory.java ! test/tools/javac/diags/Example.java + test/tools/javac/diags/MessageFile.java + test/tools/javac/diags/MessageInfo.java ! test/tools/javac/diags/RunExamples.java