ssl - Async task and https android -
i have android app , added ssl website secure login information when logging in. have async task sends information check database etc.
after setting ssl correctley , see works on website. tried changing http: https: in url async task , crashes error:
08-19 19:14:16.779 9314-9465/com.beerportfolio.beerportfoliopro e/androidruntime: fatal exception: asynctask #1 java.lang.runtimeexception: error occured while executing doinbackground() @ android.os.asynctask$3.done(asynctask.java:299) @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) @ java.util.concurrent.futuretask.setexception(futuretask.java:124) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:307) @ java.util.concurrent.futuretask.run(futuretask.java:137) @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:864) caused by: java.lang.illegalargumentexception: illegal character in query @ index 50: https://mydburl @ java.net.uri.create(uri.java:727) @ org.apache.http.client.methods.httpget.<init>(httpget.java:75) @ com.example.beerportfoliopro.readloginjson.readjsonfeed(readloginjson.java:90) @ com.example.beerportfoliopro.readloginjson.doinbackground(readloginjson.java:37) @ com.example.beerportfoliopro.readloginjson.doinbackground(readloginjson.java:24) @ android.os.asynctask$2.call(asynctask.java:287) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:305) ... 5 more
update:
found out error not in ssl part when using auto correct keyboard adds space @ end of user name crashes. how can eliminate space if entered?
you can write util function , use avoid such errors:
private string urlencode(string url) { if(url == null) return null; url = url.replace("[",""); url = url.replace("]",""); url = url.replaceall(" ","%20"); return url; }
Comments
Post a Comment