package com.github.kostyasha.yad.utils;

import com.github.kostyasha.yad.DockerSlaveSingle;
import jenkins.model.Jenkins;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

import static java.util.Objects.nonNull;

public class DockerUtils {
    private static final Logger LOG = LoggerFactory.getLogger(DockerUtils.class);

    private DockerUtils() {
    }

    public static void jenkinsAddNodeWithRetry(DockerSlaveSingle slave) throws IOException,
            InterruptedException {
        IOException lastException = null;
        int retries = 6;

        while (retries >= 0) {
            try {
                Jenkins.getInstance().addNode(slave);
            } catch (IOException ex) {
                lastException = ex;
                if (retries <= 0) {
                    throw ex;
                }
                LOG.trace("Failed to add DockerSlaveSingle node to Jenkins, retrying...", ex);
                Thread.sleep(1000);
            } finally {
                retries--;
            }
        }
        if (nonNull(lastException)) {
            throw lastException;
        }

        throw new IllegalStateException("Failed to add DockerSlaveSingle...");
    }


}

@@ -206,50 +206,8 @@
 n;%0A%0A
-import static java.util.Objects.nonNull;%0A%0A
 publ
@@ -645,16 +645,40 @@
 slave);%0A
+                return;%0A
         
@@ -1038,167 +1038,36 @@
   %7D%0A
-        if (nonNull(lastException)) %7B%0A            throw lastException;%0A        %7D%0A%0A        throw new IllegalStateException(%22Failed to add DockerSlaveSingle...%22)
+%0A        throw lastException
 ;%0A  

Fix return (#263)