Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
pascallambert
Posts: 24
Registered: ‎08-07-2008
My Device: Not Specified

EOFException on a Bluetooth DataInputStream connection

Am I wrong or it doesn't make sense to get an EOFException when reading from a DataInputStream obtain from a bluetooth connection?

We are "streaming" a "network" connection. I could understand getting it from a FileInputStream but not from "network" connection.

 

Blackberry 8700 v4.2.1.101 (Platform 2.3.0.81) 

 

String url = "btspp://008098D4BB48:1;authenticate=false;encrypt=false;master=false";

StreamConnection connection = (StreamConnection)Connector.open(url);
DataInputStream inputStream = connection.openDataInputStream();
LEDataInputStream efmInput = new LEDataInputStream(inputStream);  // LEDataInputStream is just a wrapper class to read the stream in Little Endian.

....

int b = efmInput.readUnsignedByte();

 

The funny things is I get this exception only when I keep my form "active" by rolling the wheel. The form is simply compose of 2 String (label) and 2 Gauge. If I turn the wheel to prevent the screen to turn off (power saving option) I get the problem. If I leave the wheel alone I don't get it. Like if the CPU was too busy to process both the connection and refreshing the screen. 

 

Here is the stacktrace grap from the Event log.

---------------------------------------------
Name: EOFException
GUID: 9c3cd62e3320b498
Time: Aug 07, 2008 14:06:45
No detail message
net_rim_cldc-1
 DataInputStream
 readUnsignedByte
 0x39FB
zedi_efmwalkup
 LEDataInputStream
 readUnsignedByte
 0x6943
zedi_efmwalkup
 FISession
 readFIPacket
 0x4D77
zedi_efmwalkup
 FISession
 readThreadProcess
 0x4F63
zedi_efmwalkup
 FISession$ReadingThread
 run
 0x5097

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,677
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: EOFException on a Bluetooth DataInputStream connection

What line of code is triggering the exception?  What type of Bluetooth device are you connecting to?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
pascallambert
Posts: 24
Registered: ‎08-07-2008
My Device: Not Specified

Re: EOFException on a Bluetooth DataInputStream connection

>> What line of code is triggering the exception?

int b = efmInput.readUnsignedByte();

 

>> What type of Bluetooth device are you connecting to?

A Ezurio Bluetooth module.

 

 

I solve my problem with the following code:

int b;
while ((b = in.read()) == -1) {
    Thread.sleep(100);
}
buffer[index] = (byte)b;

 

But I can't still understand why I was getting it. I had the same code running on a Nokia 5300 without any issue. And again I get the problem on the Blackberry only If I generate some "other activity" on the BB by turn the wheel going from the different element in my form.

 

Please use plain text.