BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-17-2007, 10:35 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Model: 8100
PIN: N/A
Carrier: movistar
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Error Httpconnection

Please Login to Remove!

Hello I have a called class syncrom in syncrom.java that the use to connect with httpconnection to a data base this class to me gives back string to me that it load with inputstream.

public class Syncrom extends Thread {

public String tipoConeccion = “visitasConn”;
public sServidor String = “200.200.200.200”; //IP SERVER

public String sConexion (String sQuery) {
httpConnector HttpConnection = null;
InputStream in = null;
StringBuffer to inBuffer = new StringBuffer ();
String response;
String cadenaResponse = "";
byte [] bufferLectura;

int to inChar;
retData String = "";
String URL = “http:// " +sServidor+”/“+tipoConeccion+” .asp? Q= " + sQuery;

try {
Common common = new Common ();
httpConnector = (HttpConnection) Connector.open (comun.replace (URL, ““, “%20”));
httpConnector.setRequestMethod (HttpConnection.GET);
httpConnector.setRequestProperty (“Content-Type”, “text/plain”);
in = httpConnector.openInputStream ();
long longitudDatos = httpConnector.getLength ();

bufferLectura = new byte [(int) longitudDatos];
in.read (bufferLectura);
cadenaResponse = new String (bufferLectura);

} catch (IOException ioe) {
System.out.println (“>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ERROR: “+ioe);
}
return cadenaResponse.substring (4, cadenaResponse.length ());
}


}

this class I call it of other classes.
when executing my application sends the following error to me:

“Uncaught exeption: blocking operation not permitted on event dispatch thread”

since I can cause that it works
Offline  
Old 08-22-2007, 01:10 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Model: 8100
PIN: N/A
Carrier: movistar
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default hello

sombody can help me??????
Offline  
Old 08-24-2007, 12:08 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Skipper_Joe's Avatar
 
Join Date: Jan 2007
Location: Kharkov, Ukraine
Model: 8300
Carrier: N/A
Posts: 237
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You probably call your sConexion() method from UI event thread. This is incorrect and you can't call long operations there - it will freeze UI.
You should call network operations in separate thread.
Offline  
Closed Thread


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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