在Async任务中返回XML值会引发异常而不显示任何消息

时间:2014-09-15 20:33:31

标签: android xml

我正在关注位于http://developer.android.com/training/basics/network-ops/xml.html

的开发人员教程

在大多数情况下,它已经很顺利,而我的成绩约为90%,我的问题出在我的XmlNetwork课程中,我有以下功能

    @Override
protected String doInBackground(String... urls) {
    try {
        return loadXmlFromNetwork(urls[0]);
    } catch (IOException e) {
        //return getResources().getString(R.string.connection_error);
        return "connection error";
    } catch (XmlPullParserException e) {
        //return getResources().getString(R.string.xml_error);
        String temp = e.getMessage();
        return "xml error";
    }
}

我在loadXmlFromNetwork有一个断点,我可以通过整个函数,它返回数据,正确格式化并将其返回。一旦它退出该功能,并返回到该功能,它会立即跳转到return "xml error";。这对我来说非常困惑,因为数据格式正确并以字符串形式返回,看起来一切正常。它似乎也没有向temp输出任何信息,所以我可以看到抛出了什么XmlPullParserException,所以我没有很多调试信息可以使用。

为什么它会从函数调用中看起来正确返回的值跳转到异常的任何想法?或为什么例外的价值不会显示?

如果有必要,我也可以发布这两个课程,如果你想看到整个课程,请告诉我。

感谢。

编辑:堆栈跟踪按要求

09-15 14:47:34.329  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ Sending WAIT chunk
09-15 14:47:34.329  15698-15698/com.compinc.webviewwithnativenav W/ActivityThread﹕ Application com.compinc.webviewwithnativenav is waiting for the debugger on port 8100...
09-15 14:47:34.399  15698-15708/com.compinc.webviewwithnativenav I/art﹕ Debugger is active
09-15 14:47:34.549  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ Debugger has connected
09-15 14:47:34.549  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ waiting for debugger to settle...
09-15 14:47:34.749  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ waiting for debugger to settle...
09-15 14:47:34.949  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ waiting for debugger to settle...
09-15 14:47:35.149  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ waiting for debugger to settle...
09-15 14:47:35.349  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ waiting for debugger to settle...
09-15 14:47:35.549  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ waiting for debugger to settle...
09-15 14:47:35.759  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ waiting for debugger to settle...
09-15 14:47:35.959  15698-15698/com.compinc.webviewwithnativenav I/System.out﹕ debugger has settled (1367)
09-15 14:47:36.509  15698-15698/com.compinc.webviewwithnativenav V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {6557eeb8}
09-15 14:47:36.519  15698-15698/com.compinc.webviewwithnativenav I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
09-15 14:47:36.519  15698-15698/com.compinc.webviewwithnativenav I/chromium﹕ [INFO:library_loader_hooks.cc(116)] Chromium logging enabled: level = 0, default verbosity = 0
09-15 14:47:36.589  15698-15698/com.compinc.webviewwithnativenav I/BrowserStartupController﹕ Initializing chromium process, renderers=0
09-15 14:47:36.599  15698-15698/com.compinc.webviewwithnativenav W/art﹕ Attempt to remove local SIRT entry from IRT, ignoring
09-15 14:47:36.629  15698-15698/com.compinc.webviewwithnativenav E/AudioManagerAndroid﹕ BLUETOOTH permission is missing!
09-15 14:47:36.669  15698-15698/com.compinc.webviewwithnativenav I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
09-15 14:47:36.709  15698-15816/com.compinc.webviewwithnativenav W/art﹕ Thread[15,tid=15816,Native,Thread*=0x497ad6d8,peer=0x655dd950,"Thread-220408"] attached without supplying a name
09-15 14:47:36.729  15698-15811/com.compinc.webviewwithnativenav W/art﹕ Thread[16,tid=15811,Native,Thread*=0x4954e308,peer=0x655de948,"Thread-220409"] attached without supplying a name
09-15 14:47:36.819  15698-15816/com.compinc.webviewwithnativenav W/chromium﹕ [WARNING:proxy_service.cc(890)] PAC support disabled because there is no system implementation
09-15 14:47:36.859  15698-15698/com.compinc.webviewwithnativenav W/art﹕ Attempt to remove local SIRT entry from IRT, ignoring
09-15 14:47:37.059  15698-15826/com.compinc.webviewwithnativenav W/art﹕ Thread[18,tid=15826,Native,Thread*=0x49677330,peer=0x6561da30,"Thread-220413"] attached without supplying a name
09-15 14:47:37.329  15698-15698/com.compinc.webviewwithnativenav D/AudioManagerAndroid﹕ ==> onReceive: s=0, m=0, n=h2w, sb=true
09-15 14:47:37.329  15698-15698/com.compinc.webviewwithnativenav D/AudioManagerAndroid﹕ reportUpdate: state=0, devices=[Speakerphone, Headset earpiece]
09-15 14:47:37.809  15698-15698/com.compinc.webviewwithnativenav D/OpenGLRenderer﹕ Enabling debug mode 0
09-15 14:47:38.269  15698-15698/com.compinc.webviewwithnativenav I/Choreographer﹕ Skipped 45 frames!  The application may be doing too much work on its main thread.
09-15 14:47:38.309  15698-15698/com.compinc.webviewwithnativenav W/AwContents﹕ nativeOnDraw failed; clearing to background color.
09-15 14:47:39.289  15698-15844/com.compinc.webviewwithnativenav W/art﹕ Thread[21,tid=15844,Native,Thread*=0x4bcfe5e8,peer=0x65654700,"Thread-220416"] attached without supplying a name
09-15 14:47:39.309  15698-15698/com.compinc.webviewwithnativenav I/chromium﹕ [INFO:CONSOLE(0)] "The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect.", source: http://beta.html5test.com/ (0)
09-15 14:47:39.309  15698-15698/com.compinc.webviewwithnativenav I/chromium﹕ [INFO:CONSOLE(0)] "The 'X-WebKit-CSP' headers are no longer supported. Please consider using the canonical 'Content-Security-Policy' header instead.", source:  (0)
09-15 14:47:39.779  15698-15812/com.compinc.webviewwithnativenav W/art﹕ Thread[22,tid=15812,Native,Thread*=0x4f388538,peer=0x6565aca0,"Thread-220417"] attached without supplying a name
09-15 14:47:39.819  15698-15698/com.compinc.webviewwithnativenav I/chromium﹕ [INFO:CONSOLE(0)] "Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'unsafe-inline' *". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
    ", source:  (0)

0 个答案:

没有答案