Hi,
I am developing an application where I send some music to server . For many requests it works very well, but afterward it throws unhanded exception and asks to close the application or not?
Following is the code :
httpConnection = (HttpConnection) Connector.open(strUrl);
httpConnection.setRequestMethod(HttpConnection.POST);
if (fileData == null) {
httpConnection.setRequestProperty("Content-Type",CONTENT_TYPE_JSON);
if(strUrl.indexOf("/SetStatus")!=-1){
if(COOKIE!=null){
httpConnection.setRequestProperty("Cookie", COOKIE);
}
}
}
else {
httpConnection.setRequestProperty("Content-Type", CONTENT_TYPE_JSON_BINARY);
httpConnection.setRequestProperty("X-Content-Length", String.valueOf(fileData.length));
if(COOKIE!=null){
httpConnection.setRequestProperty("Cookie", COOKIE);
}
}
httpConnection.setRequestProperty("X-Json-Length", String.valueOf(postData.length()));
outpuStream = httpConnection.openOutputStream();
outpuStream.write(postData.getBytes());
if (fileData != null)
{
outpuStream.write(fileData);
}
outpuStream.flush();
int respCode = httpConnection.getResponseCode();
inputStream = httpConnection.openInputStream();
String xStatus = httpConnection.getHeaderField("X-Status");
I am not getting where I am lagging. My all code is in try catch block. Then why this unhanded exception occurred?

Reply With Quote

