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
YongXue
Posts: 1
Registered: ‎02-08-2009
My Device: Not Specified

8820 TCP Connection Exception: java.lang.NumberFormatException

Hi all,

I use socket to open an url and download the data, the url is

m_url = socket://xx.xx.xx:2009/vdata.v

(StreamConnection)Connector.open(m_url);

 

it  works greate on jde 4.5 8820 emulator, but when i run it on real bb 8820 device(OS version:v4.5.0.81)

it throws an exception when call Connector.open(m_url)

 

java.lang.NumberFormatException: 2009/vdata.v

 

 

it seems when Connector.open parse the host&port,

it just use ':' to simply split the m_url, and doesn't check the '\' stuff~

 

so can any one give me any advices?

 

Many Thanks!

 

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: 8820 TCP Connection Exception: java.lang.NumberFormatException

An example of a socket connection with the full APN info provided:

 

Connector.open
("socket://yourServer:5445;deviceside=true;apn=internet.com;
tunnelauthusername=user165;tunnelauthpassword=user165password")

 

I don't understand what the "/vdata.v" is supposed to represent in your code snippet. Whatever it is, I don't think it belongs there.

 

You should review these documents from the knowledgebase:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/How_To_...

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

 

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: 8820 TCP Connection Exception: java.lang.NumberFormatException

LOL- I'm glad it didn't throw an assertion failure suggesting OCD attitudes here too.

Number conversion in java is annoying since atoi in C seems to ignore trailing junk and I hate

to keep using trim(). In any case, you make a socket connection to an IP address or perhaps

an interface, not a url.

Please use plain text.