The code is as follows: try { URL link = new URL(apiUrl.toString().trim().replaceAll(" ", "%20")); Log.i(TAG, "-----URL: "+link.toString()); getResponse(link.toString()); /*DISPLAYS THE HTTP RESPONSE ON SCREEN AS DEBUG MESSAGES*/
URLConnection conn = link.openConnection(); conn.connect(); BufferedReader in = new BufferedReader(new InputStreamReader (conn.getInputStream())); String inputLine; // Log.i Log.i(TAG, "-----RESPONSE START-----"); while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); } in.close(); Log.i(TAG, "-----RESPONSE END-----"); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } The Logcat output is as below: I/DELICIOUS ADApTER SERVICE( 1280): -----URL: https://ashwin_loves_android%20:th e2009nissan...@api.del.icio.us/v1/posts/add?url=http://www.google.com/ &descripti on=Google&replace=no D/InetAddress( 1280): api.del.icio.us: 76.13.6.208 (family 2, proto 6) D/dalvikvm( 1280): GC freed 10180 objects / 636520 bytes in 165ms I/dalvikvm( 1280): Uncaught exception thrown by finalizer (will be discarded): I/dalvikvm( 1280): Ljava/lang/IllegalStateException;: Finalizing cursor android. database.sqlite.sqlitecur...@430ff730 on bookmarks that has not been deactivated or closed I/dalvikvm( 1280): at android.database.sqlite.SQLiteCursor.finalize(SQLiteC ursor.java:596) I/dalvikvm( 1280): at dalvik.system.NativeStart.run(Native Method) D/dalvikvm( 1280): GC freed 8351 objects / 592432 bytes in 216ms D/dalvikvm( 706): GC freed 111 objects / 6128 bytes in 224ms D/dalvikvm( 1280): GC freed 9159 objects / 478240 bytes in 148ms D/OpenSSLSessionImpl( 1280): Freeing OpenSSL session W/ResponseProcessCookies( 1280): Cookie rejected: "[version: 0][name: delicious_ us_production][value: 0MYX_iTE_WJRglbnXQltmbcAVib9uQ9eKKlGb4iO3.Q7a8n6ymY4p8.P4f DggPKOhJQHUtYBJLE0b8QhcwLdY_NZCg5jGHuKmMawRibf_owBHCjK4alYXZmkpJnJ4gUFnYjpj2NoXl upfyK1F.rNL_yT1R_zaXuagaMUK1fBTjtIbNRcyTt3bb72eU4A6yhZaJ3UT_6zIP9v4po64cX3g1i_7o z6yRMNbG5Mlo5CR6tpE9sh0Unv2uX. 8oUTTQTGlwEuxYx3getYGLP9l_ieTsgZD11bvulWVKs1bqnWeO mnsh771_PgceCofgqISH.YTkVzEyghFrI-][domain: .delicious.com][path: /] [expiry: Sat Aug 14 14:06:13 PDT 2010]". Illegal domain attribute "delicious.com". Domain of origin: "api.del.icio.us" I/HTTP GET RESPONSE: ( 1280): org.apache.http.message.basichttprespo...@43199800 I/HTTP STREAM CONTENT: ( 1280): org.apache.http.conn.eofsensorinputstr...@430cf9 b0 D/dalvikvm( 1280): GC freed 8024 objects / 523520 bytes in 147ms D/dalvikvm( 1280): GC freed 8921 objects / 826880 bytes in 148ms I/ActivityManager( 59): Start proc com.tni.TasKiller for broadcast com.tni.Tas Killer/.TaskBarWidget: pid=1474 uid=10029 gids={} I/dalvikvm( 1474): Debugger thread not active, ignoring DDM send (t=0x41504e4d l =38) I/dalvikvm( 1474): Debugger thread not active, ignoring DDM send (t=0x41504e4d l =38) I/ActivityManager( 59): Process android.process.media (pid 1444) has died. W/System.err( 1280): java.lang.NullPointerException W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt p.HttpURLConnection.readln(HttpURLConnection.java:1181) W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt p.HttpURLConnection$ChunkedInputStream.readChunkSize (HttpURLConnection.java:394) W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt p.HttpURLConnection$ChunkedInputStream.<init>(HttpURLConnection.java: 346) W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt p.HttpURLConnection.getContentStream(HttpURLConnection.java:1077) W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt p.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1652) W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt p.HttpURLConnection.doRequest(HttpURLConnection.java:1547) W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt p.HttpURLConnection.getInputStream(HttpURLConnection.java:1055) W/System.err( 1280): at org.apache.harmony.luni.internal.net.www.protocol.htt ps.HttpsURLConnection.getInputStream(HttpsURLConnection.java:257) W/System.err( 1280): at com.android.angel.delicious.gateway.DeliciousUpdateSe rvice.processPrimaryUser(DeliciousUpdateService.java:155) W/System.err( 1280): at com.android.angel.delicious.gateway.DeliciousUpdateSe rvice.startUpdateService(DeliciousUpdateService.java:72) W/System.err( 1280): at com.android.angel.delicious.service.DeliciousSyncServ ice$SyncJob.run(DeliciousSyncService.java:93) W/System.err( 1280): at com.android.angel.delicious.service.WakeWorkManager.p rocess(WakeWorkManager.java:65) W/System.err( 1280): at com.android.angel.delicious.service.WakeWorkManager.a ccess$0(WakeWorkManager.java:61) W/System.err( 1280): at com.android.angel.delicious.service.WakeWorkManager$1 .run(WakeWorkManager.java:53) W/System.err( 1280): at java.lang.Thread.run(Thread.java:1058) I/ActivityManager( 59): Stopping service: com.android.angel.delicious/.service .DeliciousSyncService ^C The Null Pointer Exception is cause at this line BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); This is because the connection was unsuccessful. The important is part is the Cookie Rejected response before the exception. This is also a cursor finalize error, but that would have nothing to do with Http connection, right ? Any help is appreciated. Thanks, Ashwin. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---