patterntesting.exception.net
Class SocketExceptionHelper

java.lang.Object
  extended by patterntesting.exception.net.SocketExceptionHelper

public final class SocketExceptionHelper
extends Object

The Class SocketExceptionHelper with some utility methods for better SocketExceptions or NoRouteToHostExceptions.

Since:
1.0 (12.05.2010)
Author:
oliver

Method Summary
static NoRouteToHostException getBetterNoRouteToHostException(NoRouteToHostException e, URLConnection connection)
          If the given NoRouteToHostException has only the default message ("No route to host") this message will be replaced by a better one.
static SocketException getBetterSocketException(SocketException e, URLConnection connection)
          The given SocketException is checked if it contains the host in the error message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBetterNoRouteToHostException

public static NoRouteToHostException getBetterNoRouteToHostException(NoRouteToHostException e,
                                                                     URLConnection connection)
If the given NoRouteToHostException has only the default message ("No route to host") this message will be replaced by a better one.

Parameters:
e - the original NoRouteToHostException
connection - the connection
Returns:
a NoRouteToHostException which contains the host name or address

getBetterSocketException

public static SocketException getBetterSocketException(SocketException e,
                                                       URLConnection connection)
The given SocketException is checked if it contains the host in the error message. If not it is appended.

Parameters:
e - the original SocketException
connection - the URLConnection
Returns:
a better SocketException if in the original the host is missing


Copyright © 2009-2010 PatternTesting Team. All Rights Reserved.