aspose file tools*
The moose likes Beginning Java and the fly likes how to refactor this method ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to refactor this method ?" Watch "how to refactor this method ?" New topic
Author

how to refactor this method ?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
how to refactor this method ? make it concise... too many "try-catch" and "IF-ELSE".

Thanks.

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18989
    
  40

It depends on what you mean by "concise"... if you mean "as few lines of source as possible, how about...



Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

There isn't much I would change. Just one thing: move the return true inside the try:

Or even shorter:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to refactor this method ?