OSDN Git Service

Remove OSNetworkSystem.receiveStream.
authorElliott Hughes <enh@google.com>
Thu, 22 Oct 2009 00:09:13 +0000 (17:09 -0700)
committerElliott Hughes <enh@google.com>
Thu, 22 Oct 2009 23:28:21 +0000 (16:28 -0700)
commitf3029c5855474c107861ce671b25fa119a6b4a51
treef531c17e4171c1e8b3630037c352b817f8803f15
parenta5b88a9318f583a082bd27ed745d886f545a6532
Remove OSNetworkSystem.receiveStream.

Harmony removed this some time ago, and -- if we change our read/readDirect
implementations slightly -- we can too.

I've also added some bounds checking in the Java so we don't ask native code
to perform a buffer overrun for us.

I've also rewritten the native readSocketImpl to use GetByteArrayElements and
ReleaseByteArrayElements rather than its own custom stack/heap allocation and
arbitrary 64KiB limit. (As far as I can tell from the harmony history, the
limit dates from when they always read into an on-stack buffer, and was never
removed.)

I've also brought us in line with harmony so we only pass 'address' to
readDirect, rather than 'address' and 'offset'.

I've changed SocketTest to match upstream and -- since they pulled out some
of the tests into a new file -- I've added their UnixSocketTest so we don't
miss out. Our old SocketTest's test_getInputStream is the only test my new
code doesn't pass, but I think the old SocketTest was broken and the new
SocketTest/UnixSocketTest is correct.

I've also brought us back into line with harmony's MulticastSocketTest. With
the up-to-date tests, the new code behaves the same as the old code. (With
our old tests, the new code fails the joinGroup test with a
NullPointerException instead of a junit comparison failure.)
libcore/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
libcore/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
libcore/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
libcore/luni/src/test/java/tests/api/java/net/AllTests.java
libcore/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java
libcore/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java
libcore/luni/src/test/java/tests/api/java/net/SocketTest.java
libcore/luni/src/test/java/tests/api/java/net/UnixSocketTest.java [new file with mode: 0644]
libcore/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java