Source:
<code>public Result createSession(HttpClient client, Command command) throws IOException { Capabilities desired = (Capabilities) command.getParameters().get("desiredCapabilities"); desired = desired == null ? new DesiredCapabilities() : desired; Capabilities required = (Capabilities) command.getParameters().get("requiredCapabilities"); required = required == null ? new DesiredCapabilities() : required; String des = new BeanToJsonConverter().convert(desired); String req = new BeanToJsonConverter().convert(required); StringBuilder parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append(","); amendOssParamters(parameters, des, req); parameters.append("}"); LOG.fine("Attempting bi-dialect session, assuming Postel's Law holds true on the remote end"); Optional<Result> result = createSession(client, parameters); if (!result.isPresent()) { parameters = new StringBuilder("{"); amendOssParamters(parameters, des, req); parameters.append("}"); LOG.fine("Falling back to original OSS JSON Wire Protocol."); result = createSession(client, parameters); } if (!result.isPresent()) { parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append("}"); LOG.fine("Falling back to straight W3C remote end connection"); result = createSession(client, parameters); } if (result.isPresent()) { Result toReturn = result.get(); <START> LOG.fine(String.format("Detected dialect: %s", toReturn.dialect)); <END> return toReturn; } throw new SessionNotCreatedException( String.format( "Unable to create new remote session. " + "desired capabilities = %s, required capabilities = %s", desired, required)); }</code><technical_language>leave this info? ability set java log levels... seemingly is complicated for users. log issues this is pretty important information default in console potentially need troubleshoot things</technical_language>

Target:
public Result createSession(HttpClient client, Command command) throws IOException { Capabilities desired = (Capabilities) command.getParameters().get("desiredCapabilities"); desired = desired == null ? new DesiredCapabilities() : desired; Capabilities required = (Capabilities) command.getParameters().get("requiredCapabilities"); required = required == null ? new DesiredCapabilities() : required; String des = new BeanToJsonConverter().convert(desired); String req = new BeanToJsonConverter().convert(required); StringBuilder parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append(","); amendOssParamters(parameters, des, req); parameters.append("}"); LOG.fine("Attempting bi-dialect session, assuming Postel's Law holds true on the remote end"); Optional<Result> result = createSession(client, parameters); if (!result.isPresent()) { parameters = new StringBuilder("{"); amendOssParamters(parameters, des, req); parameters.append("}"); LOG.fine("Falling back to original OSS JSON Wire Protocol."); result = createSession(client, parameters); } if (!result.isPresent()) { parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append("}"); LOG.fine("Falling back to straight W3C remote end connection"); result = createSession(client, parameters); } if (result.isPresent()) { Result toReturn = result.get(); LOG.info(String.format("Detected dialect: %s", toReturn.dialect)); return toReturn; } throw new SessionNotCreatedException( String.format( "Unable to create new remote session. " + "desired capabilities = %s, required capabilities = %s", desired, required)); }