• Post Reply Bookmark Topic Watch Topic
  • New Topic

invalid/unrecognized response problem  RSS feed

 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem with invalid or unrecognized response which the browser pop up. I put this socket codes into servlet.

System.out.println("111");
BufferedReader xmlvalue = new BufferedReader(new InputStreamReader(s.getInputStream()));
System.out.println(xmlvalue);
System.out.println("222");

String input = xmlvalue.readLine();

System.out.println("333");
pw.println(xmlvalue);


os.close();
is.close();
s.close();



The debug line in error log is

111
java.io.BufferedReader@6079679
222

and it stop at the readline method
Does anybody know what does java.io.BufferedReader@6079679 means?

Is there any other way i could display the input stream?
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.out.println(xmlvalue); is to blame.
You would prefer: System.out.println(input);

By the way, because BufferedReader has not overriden Object.toString(), it inherits the implementation in Object class. That is why you get java.io.BufferedReader@6079679
 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not know exactly what you mean in the last 2 lines. Anyway I change my code to



and delete all the System.out.println(xmlvalue)

the log file still print similar result:
111
222
321
java.io.BufferedReader@61a23c2
333

What should be done to get the real results? thanks

Originally posted by Jose Botella:
System.out.println(xmlvalue); is to blame.
You would prefer: System.out.println(input);

By the way, because BufferedReader has not overriden Object.toString(), it inherits the implementation in Object class. That is why you get java.io.BufferedReader@6079679
 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I know what you mean in the previous post which has to do with toString(). Now I use the line

String input = (String) xmlvalue.readLine();

and the problem seems to be from this line. The browser mentioned invalid/unrecognized response. The error log stopped printing at this line.
What normally produce these error? I am expecting a string of xml codes from the readline(). Thank you
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!