public static int getPort(Config config, String path) {
        try {
            return new InetSocketAddress(config.getInt(path)).getPort();
        } catch (IllegalArgumentException e) {
            throw badValue(e, config, path);
        }
    }
public static int getPort ( Config config , String path ) { try { return new InetSocketAddress ( config . getInt ( path ) ) . getPort ( ) ; } catch ( IllegalArgumentException e ) { throw badValue ( e , config , path ) ; } }
Get a port number.

@param config a configuration object
@param path the path expression
@return a port number
@throws ConfigException.Missing if the value is absent or null
@throws ConfigException.WrongType if the value is not convertible to
an integer
@throws ConfigException.BadValue if the value is outside the port
number range