• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to test for unusual return value  RSS feed

 
s hughes
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a client/server app that returns, depending on the request, an int or String. I can handle these ok. There is another return value that consists of an int, which indicates the number of items (Strings) that follow. The name of each item is then returned on its own line.

I am at a complete loss as to how I would test for a return like this.

Any hints?

Thanks

Steve
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think I understand the question. It sounds like you want to test an int to determine whether it's going to be "followed" by Strings.

Or are you actually asking how to get a method to return an arbitrary number of Strings? (If that's the case, then you probably want to return an array of String objects.)
[ June 25, 2005: Message edited by: marc weber ]
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your client/server protocol ... how do they talk to each other? In some protocols it's hard to tell when the response is complete, butif you can get past that maybe you can:

This looks easy, but if it were that easy, the server wouldn't really need to tell you how many lines there were. So I suspect it's going to be trickier than that!

Can you show us a bit of the code that "gets" responses from the server?
[ June 26, 2005: Message edited by: Stan James ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!