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


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/




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