This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FYI: Patch: java.net: socket stuff


On Tue, Nov 25, 2003 at 02:57:23PM +0100, Dalibor Topic wrote:
> Michael Koch wrote:
> >Hi list,
> >
> >
> >I commited the attached big patch to fix several issues in the socket 
> >stuff. This mainly adds checks to many methods to see if the socket is 
> >closed already.
> 
> I like the patch, though I'm not a gcj developer. I have one small nit 
> to pick, though. Instead of copying
> 
>     if (isClosed())
>       throw new SocketException("socket is closed");
> 
> so many times, you could have used a private method to do the checking 
> and throwing.
> 
> 	checkIfIsClosed();
> 
> private void checkIfIsClosed() throws SocketException {
>    if (isClosed())
>       throw new SocketException("socket is closed");
> }
> 
> Code duplication is evil ;)

Introducing a new method for this really unnecessary. It doenst make the
code more clear.

> I've got another small wish: as you've been wrestling with the mauve 
> tests for DatagramSocket, and managed to understand them, maybe could 
> you clean them up, and separate them into one file per tested method/API.

> That would make it much clearer what's being tested. I'll have my 
> FieldPosition mauve test refactoring & rewriting done today, maybe we 
> can discuss writing good mauve tests on the IRC and come up with some 
> small set of guidelines.

Huh ? I have no problems finding the according test when all tests are
in one file (if the tests are well written). Writing each test into one
file is really nonsense.


Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]