harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-3185) [classlib][nio] DatagramChannel.send() does not work if the ByteBuffer is exhausted to it's limit
Date Thu, 15 Feb 2007 17:23:05 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-3185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mikhail Markov updated HARMONY-3185:
------------------------------------

    Attachment: H-3185.patch

Here is the patch for the code fixing the issue.
No additional regression tests is required as this case is tested DatagramChannelTest already.

Fix description: If the ByteBuffer from which to send is exhausted, then it's not necessary
to send a datagram with zero length and content. So this check was added in the beginning
of the method.
Also, API spec for send() methods says: "The datagram is transferred from the byte buffer
as if by a regular write operation.", so the same mechanizm was already implemented in write()
method.

> [classlib][nio] DatagramChannel.send() does not work if the ByteBuffer is exhausted to
it's limit
> -------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3185
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3185
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WinXP, IA32
>            Reporter: Mikhail Markov
>         Attachments: H-3185.patch
>
>
> I have 9 constant fails in nio modules for DatagramChannelTest:
>   testSend_NoServerTwice(),
>   testSend_NoServerNonBlockingTwice(),
>   testReceiveSend_Block_Empty(),
>   testReceiveSend_NonBlock_Empty(),
>   testReceiveSend_Block_Empty_S2C(),
>   testReceiveSend_NonBlock_Empty_S2C(),
>   testReceiveSend_Block_Empty_C2S(),
>   testReceiveSend_NonBlock_Empty_C2S(),
>   testReceiveSend_Empty_S2S()
> Here is the simple testcase reproducing the problem:
> On RI it silently passes, but on Harmony it fails with this message: "(10040) A message
sent on a datagram socket was larger than the internal message buffer or some other network
limit, or the buffer used to receive a datagram into was smaller than the datagram itself."
> ----------- Test.java --------------
> import java.io.IOException;
> import java.net.*;
> import java.nio.*;
> import java.nio.channels.*;
> public class Test {
>     public static void main (String[] argv) throws Exception {
>         ByteBuffer writeBuf = ByteBuffer.allocateDirect(200);
>         DatagramChannel channel = DatagramChannel.open();
>         InetSocketAddress localAddr = new InetSocketAddress("127.0.0.1",
>                 getNextPort());
>         channel.send(writeBuf, localAddr);
>         channel.connect(localAddr);
>         channel.send(writeBuf, localAddr);
>     }
>     private static int getNextPort() throws IOException {
>         ServerSocket ss = new ServerSocket(0);
>         int port = ss.getLocalPort();
>         ss.close();
>         return port;
>     }
> }
> ------------------------------
> I'll provide a patch soon.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message