Great that it turned out to be so easy to "debug"! This is the sort of secondary problem that can drive one crazy for days sometimes.
On Aug 27, 2:32 pm, Achanta <[email protected]> wrote: > First of all thanks everyone for replying. > > I just discovered that the problem is not with my code but with the > number of lines that the logcat is displaying. > The problem was that I got a problem in my json reply format and my > parsing code spits an error. So I started trying to debug it by > printing the response json string in logcat. This is being truncated > always and I was guessing till now that the reply itself is being > truncated. > > So today I started plying with the response string builder and has to > write funny snippets to count characters and detect the characters at > positions I was expecting and I found that the response was being > returned completely. > I also tested my code on some other large stings and I discovered that > the logcat has a limit on the length of the string that it displays or > atleast it looked so. That was why my responses were being displayed > as truncated strings and I thought that its the problem with my code. > > So it is working fine as the code is earlier and the only problem was > that the logcat doesnot display the complete string. But it does not > cother me anymore for this problem. > > Thanks again everyone for trying to help. > > On Aug 27, 1:21 pm, ko5tik <[email protected]> wrote: > > > My game has no problem to pull and parse complete highscore list: > > >http://www.pribluda.de/highscore/lines/LinesHighscore/pull?since=0 > > > (ok, usually it is less that that - only updates sine some moment ) > > > I would check with some other tool ( SoapUI us the one ) if server > > side works > > properly and delivers everything zoy are waiting for > > > regards, > > > On Aug 27, 8:51 pm, Brion Emde <[email protected]> wrote: > > > > I'm pretty sure that if there is a limit, it is much bigger than what > > > people are saying here. > > > > I wrote a little Twitter example on Android and just doing the > > > home_timeline query can return up to 200 tweets, each up to 140 > > > characters, plus overhead. That's 10s of kilobytes per GET request. > > > > See if looking at this code > > > helps:http://github.com/brione/Brion-Learns-OAuth/blob/master/src/com/examp... > > > > On Aug 27, 12:44 pm, DanH <[email protected]> wrote: > > > > > My knowledge of the HTTP protocol is poor to begin with, and my bad > > > > memory doesn't improve it, but I vaguely recall that a single HTTP > > > > transfer is limited to 5000-odd characters (the precise number being > > > > somewhat variable) by the packet sizes used in the network. But > > > > normally the software used on each end should hide this sensitivity so > > > > that you can deal in complete data streams up to some significantly > > > > larger limit. > > > > > It could be that something in your config is causing this transfer > > > > size to be exposed. It's also possible that your coding style is > > > > opening you up to being sensitive to data stream values. In > > > > particular, null may be being returned from readLine at the end of the > > > > block, even though there is more data in the transmission. (I don't > > > > know that such is possible -- just speculating.) > > > > > Finally, it's possible that the failure is occurring on the > > > > transmission end, perhaps due to an "EOF" character embedded in the > > > > source data or some such. > > > > > On Aug 26, 5:40 pm, Achanta <[email protected]> wrote: > > > > > > I am trying to get a JSON response from our server and the response > > > > > string seems is always being truncated when the string length reaches > > > > > to around 5525 characters. > > > > > > HttpClient httpClient = new DefaultHttpClient(); > > > > > HttpPost post = new HttpPost(URL); > > > > > ResponseHandler<String> responseHandler= new BasicResponseHandler(); > > > > > String testResponse = httpClient.execute(post, responseHandler); > > > > > > I also tried this by using HttpEntity and reading the response stream. > > > > > But that also truncates the string at approximately that length. > > > > > > HttpClient httpClient = new DefaultHttpClient(); > > > > > HttpPost post = new HttpPost(URL); > > > > > // HttpGet get = new HttpGet(URL); > > > > > > HttpResponse response = null; > > > > > HttpEntity entity = null; > > > > > InputStream inputStream = null; > > > > > BufferedReader reader = null; > > > > > String result = ""; > > > > > try { > > > > > response = (HttpResponse)httpClient.execute(post); > > > > > entity = response.getEntity(); > > > > > if(entity != null){ > > > > > inputStream = entity.getContent(); > > > > > } > > > > > reader = new BufferedReader(new > > > > > InputStreamReader(inputStream), 8000); > > > > > StringBuffer builder = new StringBuffer(""); > > > > > String line = reader.readLine(); > > > > > while(line != null){ > > > > > Log.v(tag, "int max::::::::: "+Integer.MAX_VALUE); > > > > > Log.v(tag, "LINE::::::::: "+line > > > > > +reader.toString()); > > > > > Log.v(tag, "reader::::::::: "+reader.toString()); > > > > > builder.append(line+"\n"); > > > > > line = reader.readLine(); > > > > > } > > > > > inputStream.close(); > > > > > result = builder.toString(); > > > > > } catch (ClientProtocolException e) { > > > > > e.printStackTrace(); > > > > > } catch (IOException e) { > > > > > e.printStackTrace(); > > > > > } finally{ > > > > > if(inputStream != null){ > > > > > try{ > > > > > inputStream.close(); > > > > > }catch(IOException e){ > > > > > e.printStackTrace(); > > > > > } > > > > > } > > > > > } > > > > > > Please let me know how I can handle this problem. I used this post as > > > > > the reference while creating > > > > > this.http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restfu... > > > > > > I tested the link in my browser and it does return the complete JSON. > > > > > So I am sure the issue is with my code in android. > > > > > > Thank you. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

