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
Posts: 22
Registered: ‎08-05-2008
My Device: Not Specified

Illegal state exception while finishLoading()

try { browserContent = _renderingSession.getBrowserContent(connection, this, e); if (browserContent != null) { Field field = browserContent.getDisplayableContent(); if (field != null) { synchronized (Application.getEventLock()) { _mainScreen.deleteAll(); _mainScreen.add(field); } } browserContent.finishLoading();

//While finishing loading i get illegalstateexception } } catch (RenderingException re) {

 

Hi all,

 

I got illegal state exception at browserContent.finishLoading(). What are the possible reasons? Thanks!

 

By the way, it works on browser.

 

JDE 4.6.0

Simulator 9000

BlackBerry Development Advisor
Posts: 15,299
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Illegal state exception while finishLoading()

This can be thrown if you try to invoke this method on the main event thread.  Are you calling it from its own thread?
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
Highlighted
New Developer
Posts: 22
Registered: ‎08-05-2008
My Device: Not Specified

Re: Illegal state exception while finishLoading()

[ Edited ]

Hi MSohm!

 

Actually i use your code sample and i call it from different thread. Let me show you your code sample;

 

 

class PrimaryResourceFetchThread extends Thread {

private BrowserFieldApplications _application;

private Event _event;

private byte[] _postData;

private HttpHeaders _requestHeaders;

private String _url;

PrimaryResourceFetchThread(String url, HttpHeaders requestHeaders, byte[] postData, Event event, BrowserFieldApplications application) {

_url = url;
_requestHeaders = requestHeaders;
_postData = postData;
_application = application;
_event = event;
}

public void run() {
HttpConnection connection = Utilities.makeConnection(_url, _requestHeaders, _postData);
_application.processConnection(connection, _event);
//Here! I call processConnection and finishLoading is in there.
}
}

 

In addition, it works on 8820. Thanks!

 

 

Message Edited by vona on 09-18-2008 04:27 AM