Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

returning bufferedreader  RSS feed

 
Hosh Nasi
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a method that creates a bufferedreader and it suppose to return it to the calling class.

However I am having issues.



The method is held in what I call the DatabaseUtil class, in the final version of the program I will be connecting to a SQL database until then I am using a simple flatfile. So I want to keep connections, query, and linereading in the class. However I want the Factory to be able to loop through the fields that are returned

How can I get this to compile. The try block is hanging me up.
 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No guarantee in this reply, just re-learning Java, but it looks like your method should be returning a BufferedReader, yet you return a string. I guess you should be returning the BufferedReader instead.

Apologies if I'm wrong.

Mike
 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Duh, that wasn't right. You're assigning msgString to a BufferedReader, but how is msgString declared? What's the compiler message? Should be a BufferedReader?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I get this to compile. The try block is hanging me up.

How so? Are you getting an error message? If so, what is it?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!