My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 98: BufferOverflowException on correct datagram
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jun 2011


 
Reported by przemysl...@gmail.com, May 31, 2011
On writing the data to the datagram the exception occurs when the data length is exactly the size of the datagram:

	DatagramConnection con = (DatagramConnection) Connector.open("datagram://127.0.0.1:1234");
	Datagram datagram = con.newDatagram(10);
	datagram.reset();
	datagram.write(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });

causes

java.nio.BufferOverflowException
	at org.microemu.cldc.datagram.DatagramImpl$BufferOutputStream.write(DatagramImpl.java:81)
	at java.io.OutputStream.write(OutputStream.java:99)
	at java.io.DataOutputStream.write(DataOutputStream.java:90)
	at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
	at org.microemu.cldc.datagram.DatagramImpl.write(DatagramImpl.java:248)


For me, it looks like this is the problem

DatagramImpl.java:80:
	if (offset == buffer.length - 1) {
		throw new BufferOverflowException();
	}
should be
	if (offset > buffer.length - 1) {
		throw new BufferOverflowException();
	}

Microemu 2.0.4.

Jun 17, 2011
Project Member #1 bar...@gmail.com
Fixed in trunk
Status: Fixed
Labels: Milestone-3.0

Powered by Google Project Hosting