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
On Tue, Nov 25, 2003 at 07:23:39PM -0600, Mohan Embar wrote:
> 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";
Okay, okay, okay. You cooked me. Please provide a patch for this. I will
accept it and Tom will have nothing against it too I assume.
Personally I think the name for constant should be SOCKET_CLOSE. Thats
clear enough.
Michael