BlackBerry downloading a file-Collection of common programming errors
I have a blackberry application that is downloading a file from online. Sometimes the download succeeds and other times it fails somewhere in the middle. It only seems to be a problem on the Curve 9360 device. When it fails, on the device it closes my app and shows a pop-up that says
“Uncaught exeption Application [MyApp] is not responding; process terminated”
this is the while loop that it is in when it fails:
byte data[] = new byte[1024];
try {
while ((count = is.read(data)) != -1) {
total += count;
progress = (int)(total*100/lengthOfWebFile);
if(model.getValue() < progress){
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
EmbeddedMediaScreen.this.model.setValue(progress);
}
});
}
//write this chunk
os.write(data, 0, count);
}
} catch (Exception e) {
e.printStackTrace();
}
I don’t get any kind of stack trace in the console when this happens. I get the following:
[710.328] Application BBCurve9360DemoLoop(314) is not responding; process terminated
[710.328]
[710.429] [0 0]
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
.[lots more "0 2"s]
.
.
.
[710.429] 2 203
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
[710.429] 0 2
.[lots more "0 2"s
.
.
Has anyone run across anything like this while pro grammatically downloading a file on a blackberry device?
Can anyone see anything in my IO loop that would cause this type of crash?
And lastly does anyone know if there is someway that I can get an actual stack trace of whatever exception is being thrown?