Program: 77334
Project: 77334
Buggy source:
/** 
 * Sends a message via this channel. <P> If this channel is unbound then this method will invoke   {@link #bind(SocketAddress,int) bind(null, 0)} before sending any data.<P> If there is no association existing between this channel's socket and the intended receiver, identified by the address in the given messageInfo, then one will be automatically setup to the intended receiver. This is considered to be Implicit Association Setup. Upon successful association setup, an {@link AssociationChangeNotification association changed}notification will be put to the SCTP stack with its   {@code event} parameter setto  {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP COMM_UP}. This notification can be received by invoking   {@link #receive receive}. <P> If this channel is in blocking mode, there is sufficient room in the underlying output buffer, then the remaining bytes in the given byte buffer are transmitted as a single message. Sending a message is atomic unless explicit message completion   {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}socket option is enabled on this channel's socket. <P> If this channel is in non-blocking mode, there is sufficient room in the underlying output buffer, and an implicit association setup is required, then the remaining bytes in the given byte buffer are transmitted as a single message, subject to   {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}. If for any reason the message cannot be delivered an   {@link AssociationChangeNotification associationchanged} notification is put on the SCTP stack with its {@code event} parameter setto  {@link AssociationChangeNotification.AssocChangeEvent#CANT_START CANT_START}. <P> The message is transferred from the byte buffer as if by a regular  {@link java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) write} operation.<P> If a security manager has been installed then for each new association setup this method verifies that the given remote peers address and port number are permitted by the security manager's  {@link java.lang.SecurityManager#checkConnect(String,int) checkConnect} method.<P> This method may be invoked at any time. If another thread has already initiated a send operation upon this channel, then an invocation of this method will block until the first operation is complete.
 * @param buffer The buffer containing the message to be sent
 * @param messageInfo Ancillary data about the message to be sent
 * @return  The number of bytes sent, which will be either the number ofbytes that were remaining in the messages buffer when this method was invoked or, if this channel is non-blocking, may be zero if there was insufficient room for the message in the underlying output buffer
 * @throws InvalidStreamExcepton If  {@code streamNumber} is negative, or if an association alreadyexists and  {@code streamNumber} is greater than the maximum numberof outgoing streams
 * @throws java.nio.channels.ClosedChannelException If this channel is closed
 * @throws java.nio.channels.AsynchronousCloseException If another thread closes this channel while the read operation is in progress
 * @throws java.nio.channels.ClosedByInterruptException If another thread interrupts the current thread while the read operation is in progress, thereby closing the channel and setting the current thread's interrupt status
 * @throws SecurityException If a security manager has been installed and it does not permit new associations to be setup with the the messages's address
 * @throws IOException If some other I/O error occurs
 */
public abstract int send(ByteBuffer buffer,MessageInfo messageInfo) throws IOException ;

Fixed version (ground truth):
/** 
 * Sends a message via this channel. <P> If this channel is unbound then this method will invoke   {@link #bind(SocketAddress,int) bind(null, 0)} before sending any data.<P> If there is no association existing between this channel's socket and the intended receiver, identified by the address in the given messageInfo, then one will be automatically setup to the intended receiver. This is considered to be Implicit Association Setup. Upon successful association setup, an {@link AssociationChangeNotification association changed}notification will be put to the SCTP stack with its   {@code event} parameter setto  {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP COMM_UP}. This notification can be received by invoking   {@link #receive receive}. <P> If this channel is in blocking mode, there is sufficient room in the underlying output buffer, then the remaining bytes in the given byte buffer are transmitted as a single message. Sending a message is atomic unless explicit message completion   {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}socket option is enabled on this channel's socket. <P> If this channel is in non-blocking mode, there is sufficient room in the underlying output buffer, and an implicit association setup is required, then the remaining bytes in the given byte buffer are transmitted as a single message, subject to   {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}. If for any reason the message cannot be delivered an   {@link AssociationChangeNotification associationchanged} notification is put on the SCTP stack with its {@code event} parameter setto  {@link AssociationChangeNotification.AssocChangeEvent#CANT_START CANT_START}. <P> The message is transferred from the byte buffer as if by a regular  {@link java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) write} operation.<P> If a security manager has been installed then for each new association setup this method verifies that the given remote peers address and port number are permitted by the security manager's  {@link java.lang.SecurityManager#checkConnect(String,int) checkConnect} method.<P> This method may be invoked at any time. If another thread has already initiated a send operation upon this channel, then an invocation of this method will block until the first operation is complete.
 * @param buffer The buffer containing the message to be sent
 * @param messageInfo Ancillary data about the message to be sent
 * @return  The number of bytes sent, which will be either the number ofbytes that were remaining in the messages buffer when this method was invoked or, if this channel is non-blocking, may be zero if there was insufficient room for the message in the underlying output buffer
 * @throws InvalidStreamException If  {@code streamNumber} is negative, or if an association alreadyexists and  {@code streamNumber} is greater than the maximum numberof outgoing streams
 * @throws java.nio.channels.ClosedChannelException If this channel is closed
 * @throws java.nio.channels.AsynchronousCloseException If another thread closes this channel while the read operation is in progress
 * @throws java.nio.channels.ClosedByInterruptException If another thread interrupts the current thread while the read operation is in progress, thereby closing the channel and setting the current thread's interrupt status
 * @throws SecurityException If a security manager has been installed and it does not permit new associations to be setup with the the messages's address
 * @throws IOException If some other I/O error occurs
 */
public abstract int send(ByteBuffer buffer,MessageInfo messageInfo) throws IOException ;