0

当调用forge.ajax和请求返回带有 JSON 的 401 时,仅在 Android 下(设备和模拟器)我收到以下错误消息:

[信息] D/Forge (25373): 返回: {"content":{"type":"UNEXPECTED_FAILURE","message":"Forge Java 错误: NullPointerException: null","full_error":"java.lang.NullPointerException \n\tat io.trigger.forge.android.modules.request.API$1$1.getPasswordAuthentication(API.java:107)\n\tat java.net.Authenticator.requestPasswordAuthentication(Authenticator.java:140)\n\tat libcore.net.http.HttpURLConnectionImpl.getAuthorizationCredentials(HttpURLConnectionImpl.java:432)\n\tat libcore.net.http.HttpURLConnectionImpl.processAuthHeader(HttpURLConnectionImpl.java:407)\n\tat libcore.net.http.HttpURLConnectionImpl.processResponseHeaders( HttpURLConnectionImpl.java:356)\n\tat libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:292)\n\tat libcore.net.http.HttpURLConnectionImpl。getInputStream(HttpURLConnectionImpl.java:168)\n\tat io.trigger.forge.android.modules.request.API$1.run(API.java:285)\n\tat io.trigger.forge.android.core.ForgeTask $1.doInBackground(ForgeTask.java:112)\n\tat android.os.AsyncTask$2.call(AsyncTask.java:287)\n\tat java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305 )\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:137)\n\tat android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)\n\tat java.util. concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java: 856)\n"},"状态":"错误","callid":"46C2A570-7229-4427-9BF8-F64FB12F6D8F"}android.modules.request.API$1.run(API.java:285)\n\tat io.trigger.forge.android.core.ForgeTask$1.doInBackground(ForgeTask.java:112)\n\tat android.os. AsyncTask$2.call(AsyncTask.java:287)\n\tat java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java :137)\n\tat android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\n\tat java. util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java:856)\n"},"status":"error","callid" :“46C2A570-7229-4427-9BF8-F64FB12F6D8F”}android.modules.request.API$1.run(API.java:285)\n\tat io.trigger.forge.android.core.ForgeTask$1.doInBackground(ForgeTask.java:112)\n\tat android.os. AsyncTask$2.call(AsyncTask.java:287)\n\tat java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java :137)\n\tat android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\n\tat java. util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java:856)\n"},"status":"error","callid" :“46C2A570-7229-4427-9BF8-F64FB12F6D8F”}112)\n\tat android.os.AsyncTask$2.call(AsyncTask.java:287)\n\tat java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)\n\tat java.util .concurrent.FutureTask.run(FutureTask.java:137)\n\tat android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1076)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java:856)\n"},"状态":"错误","callid":"46C2A570-7229-4427-9BF8-F64FB12F6D8F"}112)\n\tat android.os.AsyncTask$2.call(AsyncTask.java:287)\n\tat java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)\n\tat java.util .concurrent.FutureTask.run(FutureTask.java:137)\n\tat android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1076)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java:856)\n"},"状态":"错误","callid":"46C2A570-7229-4427-9BF8-F64FB12F6D8F"}concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java: 856)\n"},"状态":"错误","callid":"46C2A570-7229-4427-9BF8-F64FB12F6D8F"}concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java: 856)\n"},"状态":"错误","callid":"46C2A570-7229-4427-9BF8-F64FB12F6D8F"}

正在触发 forge.ajax 错误回调,但 error.content 对象包含上面的字符串并且没有响应。请注意,这在 iOS 上不会发生。

当您从Play 商店运行应用程序并尝试使用错误的密码/不存在的用户登录时,您可以看到这一点。

完整的源代码在github上可用

4

1 回答 1

1

当尝试访问受基本身份验证保护的 HTTP 资源时会出现这种情况,并且没有向 request.ajax 提供用户名。

该错误已在平台 v1.4.24 中修复 - 不便之处敬请见谅!

http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-24

于 2012-12-20T18:24:44.717 回答