This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: FYI: Patch: java.net: socket stuff
- From: Michael Koch <konqueror at gmx dot de>
- To: Dalibor Topic <robilad at kaffe dot org>
- Cc: Michael Koch <konqueror at gmx dot de>, java-patches at gcc dot gnu dot org
- Date: Tue, 25 Nov 2003 17:36:30 +0100
- Subject: Re: FYI: Patch: java.net: socket stuff
- References: <E1AOaAV-00078i-00@majestix.konqueror.de> <3FC35FC3.3000706@kaffe.org>
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