开发者

Android throwing exception, e.getMessage() is null

I'm currently writing an application for Android which uses Push notifications. My app is successfully registering with Google servers and getting an ID, and I have server s开发者_如何学Goide code which uses this ID and pushes a notification to the App, which is received.

When the push is received, I'm calling a custom class which, inside a thread, queries a remote server for information that will then be handled in the App.

The method that is called is this:

private Thread checkUpdate = new Thread() {
    public void run() {
        try {
            URL updateURL = new URL("http://this.site.com/some/path");
            URLConnection conn = updateURL.openConnection();

            InputStream is = conn.getInputStream();
            BufferedInputStream bis = new BufferedInputStream(is);
            ByteArrayBuffer baf = new ByteArrayBuffer(50);

            int current = 0;
            while ((current = bis.read()) != -1) {
                baf.append((byte) current);
            }

            /* Convert the Bytes read to a String. */
            html = new String(baf.toByteArray());
            mHandler.post(showUpdate);

        } catch (Exception e) {
            // Show message if there was an error with the site.
            Log.e("C2DM", "Exception: " + e.getMessage());

        }

    }
};

The line in LogCat is as follows: 07-31 18:15:59.903: INFO/C2DM(681): Exception: null

In LogCat there is no stack trace thrown because the error is handled I guess, but I'm not sure exactly what is throwing the exception or even what type of exception it is.. (though I know it's not IOException, I have tried catching that specifically and it skipped it)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜