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: Mohan Embar <gnustuff at thisiscool dot com>
- To: Michael Koch <konqueror at gmx dot de>
- Cc: Dalibor Topic <robilad at kaffe dot org>, java-patches at gcc dot gnu dot org
- Date: Tue, 25 Nov 2003 19:23:39 -0600
- Subject: Re: FYI: Patch: java.net: socket stuff
- Reply-to: gnustuff at thisiscool dot com
Hi Michael,
Like I said, I am not losing any sleep over this, so you should
consider all subsequent discussion as just for fun.
>My personal rational is that it will not make the make code more clear.
>Its better in this case to throw the exception where it makes sense.
>This helps to understand the methods more easily.
>It gains nothing if we replace two very simple lines of code with a one
>liner where you probably need to look somewhere else to see what it
>really does. Even if the name for the check method is really good a
>developer dont know at hand what it really does and if there are side
>effects.
Based on your convictions, what would be your opinion of replacing
this:
if (isClosed())
throw new SocketException("socket is closed");
...with this:
if (isClosed())
throw new SocketException(SOCKET_CLOSED_TEXT);
where SOCKET_CLOSED_TEXT is:
private static final String SOCKET_CLOSED_TEXT = "socket is closed";
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/