2013-05-14 68 views
0

當我運行我的android應用程序時出現錯誤。在與org.json.JSONException相關的錯誤:字符0處的輸入結束

字符0的輸入的結束:有時它可以順利運行,但有時它表現出如下面的錯誤:

java.net.SocketException: Connection timed out 
at org.apache.harmony.luni.platform.OSNetworkSystem.read(Native Method) 
at dalvik.system.BlockGuard$WrappedNetworkSystem.read(BlockGuard.java:273) 
at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:458) 
at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85) 
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103) 
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191) 
at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82) 
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174) 
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179) 
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235) 
at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259) 
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279) 
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121) 
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:421) 
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 

誤差變換結果顯示java.lang.NullPointerException 錯誤解析數據org.json.JSONException有人可以告訴我這個問題的主要根源是什麼? 謝謝。

+0

你需要發佈一些特定的JSON對象,或更多的線索。這一切說的是,你試圖解析一個空的對象 – greedybuddha 2013-05-14 14:19:55

+0

你可以打印出你的json字符串嗎?您的堆棧跟蹤看起來像您的連接超時 – 2013-05-14 14:25:13

回答

0

您正試圖解析一個空的對象。

所以,如果你想擺脫這個錯誤,你應該檢查以確保你試圖序列化的對象是有效的。

相關問題