app is crash when html content is coming how to handle in android? -


i register using email , password if email , domain exit successfull work if a@a.com pass in email give me html , app crash how handle content

public string webregister(string url, string u, string p)      {          // create new httpclient , send post header         httpclient httpclient = new defaulthttpclient();          // returns true if username , password valid         httppost httppost = new httppost(url);         string json = null;         inputstream is;          try          {             list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>();             namevaluepairs.add(new basicnamevaluepair("username", u));             namevaluepairs.add(new basicnamevaluepair("password", p));             httppost.setentity(new urlencodedformentity(namevaluepairs));               // getting response             httpresponse httpresponse = httpclient.execute(httppost);              = httpresponse.getentity().getcontent();              bufferedreader reader = new bufferedreader(new inputstreamreader(                     is, "iso-8859-1"), 8);             stringbuilder sb = new stringbuilder();             string line = null;              while ((line = reader.readline()) != null) {                 sb.append(line + "\n");             }             is.close();             json = sb.tostring();          } catch (exception e) {             e.printstacktrace();         }          return json;      } 

errorlogcat

06-27 19:40:23.585: e/register url(1474): ---->http://interntest.monitorwerbung.at/studio/webservices/register 06-27 19:40:23.585: e/register(1474): ----><!doctype html> 06-27 19:40:23.585: e/register(1474): <!--[if lt ie 7 ]> <html lang="de" class="no-js ie6"> <![endif]--> 06-27 19:40:23.585: e/register(1474): <!--[if ie 7 ]>    <html lang="de" class="no-js ie7"> <![endif]--> 06-27 19:40:23.585: e/register(1474): <!--[if ie 8 ]>    <html lang="de" class="no-js ie8"> <![endif]--> 06-27 19:40:23.585: e/register(1474): <!--[if ie 9 ]>    <html lang="de" class="no-js ie9"> <![endif]--> 06-27 19:40:23.585: e/register(1474): <!--[if (gt ie 9)|!(ie)]><!--> <html lang="de" class="no-js"> <!--<![endif]--> 06-27 19:40:23.585: e/register(1474): <head> 06-27 19:40:23.585: e/register(1474):   <meta http-equiv="content-type" content="text/html; charset=utf-8" />   <title>monitorwerbung - errors</title> 06-27 19:40:23.585: e/register(1474):   <link href="/studio/backend.ico" type="image/x-icon" rel="icon" /><link href="/studio/backend.ico" type="image/x-icon" rel="shortcut icon" /> 06-27 19:40:23.585: e/register(1474):   <link rel="stylesheet" type="text/css" href="/studio/css/reset.css" /><link rel="stylesheet" type="text/css" href="/studio/css/jquery-ui-1.8.18.custom.css" /><link rel="stylesheet" type="text/css" href="/studio/css/default.css" /><link rel="stylesheet" type="text/css" href="/studio/css/jquery.minicolors.css" /><script type="text/javascript" src="/studio/js/modernizr.js"></script><script type="text/javascript" src="/studio/js/jquery-1.7.1.min.js"></script><script type="text/javascript" src="/studio/js/jquery.minicolors.js"></script><script type="text/javascript" src="/studio/js/jquery-ui-1.8.18.custom.min.js"></script><script type="text/javascript" src="/studio/js/jquery.ui.datepicker-de.js"></script><script type="text/javascript" src="/studio/js/global.js"></script></head> 06-27 19:40:23.585: e/register(1474): <body> 06-27 19:40:23.585: e/register(1474):   <div id="livesearchresult"></div> 06-27 19:40:23.585: e/register(1474):   <div class="wrapper"> 06-27 19:40:23.585: e/register(1474):       <div class="sidebar"> 06-27 19:40:23.585: e/register(1474):           <div id="logo"> 06-27 19:40:23.585: e/register(1474):               <img src="/studio/img/logo.png" alt="peakmedia" />          </div> 06-27 19:40:23.585: e/register(1474):           <div class="profile-info"> 06-27 19:40:23.585: e/register(1474):               hallo <a href="/studio/managers/profile"></a>! | 06-27 19:40:23.585: e/register(1474):               <a href="/studio/managers/logout">abmelden</a>              <div>27.06.2014 16:10</div> 06-27 19:40:23.585: e/register(1474):           </div> 06-27 19:40:23.585: e/register(1474):           <div id="livesearch"> 06-27 19:40:23.585: e/register(1474):               <input type="text" name="data[search][livesearch]" id="searchlivesearch" placeholder="durchsuchen" /> 06-27 19:40:23.585: e/register(1474):           </div> 06-27 19:40:23.585: e/register(1474):            06-27 19:40:23.585: e/register(1474):                        06-27 19:40:23.585: e/register(1474):           <div class="menu"> 06-27 19:40:23.585: e/register(1474):               <ul> 06-27 19:40:23.585: e/register(1474):   <li><a href="/studio/home">dashboard</a></li> 06-27 19:40:23.585: e/register(1474):               </ul> 06-27 19:40:23.585: e/register(1474): <ul> 06-27 19:40:23.585: e/register(1474):                 06-27 19:40:23.585: e/register(1474):       </ul> 06-27 19:40:23.585: e/register(1474): <ul> 06-27 19:40:23.585: e/register(1474):           </ul> 06-27 19:40:23.585: e/register(1474): <ul> 06-27 19:40:23.585: e/register(1474):                       </ul> 06-27 19:40:23.585: e/register(1474): <ul> 06-27 19:40:23.585: e/register(1474):       </ul>           </div> 06-27 19:40:23.585: e/register(1474):       </div> 06-27 19:40:23.585: e/register(1474):       <div class="content"> 06-27 19:40:23.585: e/register(1474):           <h2>an internal error has occurred.</h2> 06-27 19:40:23.585: e/register(1474): <p class="error"> 06-27 19:40:23.585: e/register(1474):   <strong>error: </strong> 06-27 19:40:23.585: e/register(1474):   internal error has occurred.</p> 06-27 19:40:23.585: e/register(1474):                   </div> 06-27 19:40:23.585: e/register(1474):       <div class="clear"></div> 06-27 19:40:23.585: e/register(1474):   </div> 06-27 19:40:23.585: e/register(1474):       <script type="text/javascript"> 06-27 19:40:23.585: e/register(1474): //<![cdata[ 06-27 19:40:23.585: e/register(1474): $(document).ready(function () {$("#searchlivesearch").bind("keyup", function (event) {if ($("#searchlivesearch").val().length > 2) {$.ajax({async:true, data:$("#searchlivesearch").serialize(), datatype:"html", success:function (data, textstatus) {$("#livesearchresult").html(data);$("#livesearchresult").show()}, type:"post", url:"/studio/admin/search/livesearch"});return false;} else {$("#livesearchresult").hide();}});}); 06-27 19:40:23.585: e/register(1474): //]]> 06-27 19:40:23.585: e/register(1474): </script></body> 06-27 19:40:23.585: e/register(1474): </html> 

i got solutions of own question tried , work me

            boolean containshtml=false;              pattern htmlpattern = pattern.compile(".*\\<[^>]+>.*", pattern.dotall);              containshtml=htmlpattern.matcher(data).matches();             if(containshtml)             {                     \\ not parsing or set message : invalid data              }             else             {                  \\ jsonparsing here             } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -