BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-14-2008, 09:00 AM   #1
badgrs
New Member
 
Join Date: Oct 2008
Model: 8310
PIN: N/A
Carrier: T-Mobile
Posts: 9
Default "Input stream already open" when using https on OS 4.1

Please Login to Remove!

Hi,

I'm having issues with a generic JavaME application when opening an https connection on an OS 4.1 device. Using the following code I get an IOException "Input stream already open":

Code:
byte[] data = null;
DataInputStream input = null;
DataOutputStream output = null;
HttpConnection conn = null;

try {
	conn = (HttpConnection)Connector.open(url);
	input = conn.openDataInputStream();
	output = conn.openDataOutputStream();
	
	data = new byte[input.available()];
	input.readFully(data);
} catch(Throwable t) {
t.printStackTrace();
}
Looking at the stack trace I believe the exception is thrown inside conn.openDataOutputStream();

This works fine on OS 4.2 and up, and changing the url to 'http:' works fine.

Any ideas?

Cheers
Offline  
Old 10-14-2008, 02:58 PM   #2
jonberry
Thumbs Must Hurt
 
Join Date: Apr 2005
Model: 950
Carrier: T-Mobile
Posts: 185
Default

Aren't you supposed to use an HttpsConnection with https?
Offline  
Old 10-14-2008, 11:35 PM   #3
nanika
Knows Where the Search Button Is
 
Join Date: Mar 2008
Location: Paris, France
Model: None
PIN: N/A
Carrier: None
Posts: 36
Default

Do you really have to open an output stream ?
Offline  
Old 10-16-2008, 08:08 AM   #4
badgrs
New Member
 
Join Date: Oct 2008
Model: 8310
PIN: N/A
Carrier: T-Mobile
Posts: 9
Default

Quote:
Originally Posted by jonberry View Post
Aren't you supposed to use an HttpsConnection with https?
HttpsConnection extends from HttpConnection so it shouldn't make a difference.

Quote:
Originally Posted by nanika
Do you really have to open an output stream ?
Not in this example no, but in the real thing yes.
Offline  
Old 10-16-2008, 02:37 PM   #5
nanika
Knows Where the Search Button Is
 
Join Date: Mar 2008
Location: Paris, France
Model: None
PIN: N/A
Carrier: None
Posts: 36
Default

In that case, you CAN'T open the output stream once you have opened the input stream (the output stream is used to post the query parameters!).
Offline  
Old 10-16-2008, 04:44 PM   #6
badgrs
New Member
 
Join Date: Oct 2008
Model: 8310
PIN: N/A
Carrier: T-Mobile
Posts: 9
Default

Quote:
Originally Posted by nanika View Post
In that case, you CAN'T open the output stream once you have opened the input stream (the output stream is used to post the query parameters!).
Hmm, I'm not sure thats entirely true but either way I checked the code and in one place it doesn't actually use or open the output stream and in the other it opens it first.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


P4615401 Solenoid Coil 120 Volt picture

P4615401 Solenoid Coil 120 Volt

$45.00



Trans Coil Inc. Electrical Supply 600V Kdrc1L picture

Trans Coil Inc. Electrical Supply 600V Kdrc1L

$95.00



Cutler Hammer H1112 Heater Coil Lot OF 7 picture

Cutler Hammer H1112 Heater Coil Lot OF 7

$69.00



NEW 12V COIL W / INTERNAL RESISTOR picture

NEW 12V COIL W / INTERNAL RESISTOR

$21.99



Heating Coil 5 PIN XLR 20mm 16mm 10mm flat 25mm 30mm Electronic picture

Heating Coil 5 PIN XLR 20mm 16mm 10mm flat 25mm 30mm Electronic

$34.99



Ignition Coil For Briggs And Stratton 395491 397358; IBS3002 picture

Ignition Coil For Briggs And Stratton 395491 397358; IBS3002

$40.22







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.