Bug 52135 - NotYetConnectedException thrown while remote endpoint is not connected
Summary: NotYetConnectedException thrown while remote endpoint is not connected
Status: UNCONFIRMED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.98
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 12:04 UTC by mariusz
Modified: 2012-02-06 12:05 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Simple test server and client (861 bytes, application/x-gzip)
2012-02-06 12:04 UTC, mariusz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mariusz 2012-02-06 12:04:47 UTC
Created attachment 26582 [details]
Simple test server and client

GCC: cross toochain - gcc-4.1.2, uClibc 0.9.28
GNU Classpath 0.98 (and CVS head) + JamVM (git HEAD)

The 'NotYetConnectedException' is thrown if the remote endpoint closes the connection. Reproducible using the attached testcase:

java TestServer
ONE
TWO
THREE
BYE

java TestClient
Sending: ONE
Sending: TWO
Sending: THREE
Sending: BYE
Sending: FOUR
java.nio.channels.NotYetConnectedException
   at gnu.java.nio.SocketChannelImpl.read(SocketChannelImpl.java:217)
   at gnu.java.net.PlainSocketImpl$SocketInputStream.read(PlainSocketImpl.java:587)
   at java.io.InputStream.read(InputStream.java:163)
   at java.io.InputStreamReader.read(InputStreamReader.java:459)
   at java.io.BufferedReader.fill(BufferedReader.java:370)
   at java.io.BufferedReader.readLine(BufferedReader.java:469)
   at TestClient.main(TestClient.java:45)

Java_gnu_java_nio_VMChannel_getpeername function returns 0 due to getpeername returning -1. SocketChannelImpl class isConnected is calling getpeername every time! I think it should buffer the connection state during connect() instead.