/*******************************************************************************
 * Copyright (c) 2012-2016 Codenvy, S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/
package org.eclipse.che.plugin.docker.machine.local;

import com.google.inject.assistedinject.Assisted;

import org.eclipse.che.commons.annotation.Nullable;
import org.eclipse.che.plugin.docker.client.json.ContainerInfo;
import org.eclipse.che.plugin.docker.machine.DockerInstanceRuntimeInfo;

import javax.inject.Inject;
import javax.inject.Named;

import static com.google.common.base.MoreObjects.firstNonNull;

/**
 * Gets predefined docker containers host for machine servers instead of evaluating it from docker configuration
 *
 * <p>Value of host can be retrieved from property ${code machine.docker.local_node_host} or
 * from environment variable {@code CHE_DOCKER_MACHINE_HOST}.<br>
 * Environment variable has lower priority.
 *
 * @author Alexander Garagatyi
 * @see org.eclipse.che.plugin.docker.machine.ServerConf
 */
public class LocalDockerInstanceRuntimeInfo extends DockerInstanceRuntimeInfo {
    /**
     * Env variable that shows host (or IP) where docker machines are deployed
     */
    public static final String CHE_DOCKER_MACHINE_HOST = "CHE_DOCKER_MACHINE_HOST";

    @Inject
    public LocalDockerInstanceRuntimeInfo(@Assisted ContainerInfo containerInfo,
                                          @Assisted String containerHost,
                                          @Nullable @Named("machine.docker.local_node_host") String dockerNodeHost) {
        super(containerInfo, firstNonNull(firstNonNull(dockerNodeHost,
                                                       System.getenv(CHE_DOCKER_MACHINE_HOST)),
                                          containerHost));
    }
}

@@ -869,72 +869,8 @@
 d;%0A%0A
-import static com.google.common.base.MoreObjects.firstNonNull;%0A%0A
 /**%0A
@@ -1861,69 +1861,50 @@
 fo, 
-firstNonNull(firstNonNull(dockerNodeHost,%0A                   
+dockerNodeHost != null ? dockerNodeHost :%0A
     
@@ -1928,23 +1928,17 @@
         
-       
+(
 System.g
@@ -1971,52 +1971,59 @@
 OST)
-),%0A                                         
+ != null ? System.getenv(CHE_DOCKER_MACHINE_HOST) :
  con

fix NPE because of incorrect usage of firstNonNull Signed-off-by: Alexander Garagatyi <agaragatyi@codenvy.com>