All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.client.Utils Maven / Gradle / Ivy

package com.netflix.client;

import java.util.Collection;

public class Utils {
    public static boolean isPresentAsCause(Throwable throwableToSearchIn,
            Collection> throwableToSearchFor) {
        int infiniteLoopPreventionCounter = 10;
        while (throwableToSearchIn != null && infiniteLoopPreventionCounter > 0) {
            infiniteLoopPreventionCounter--;
            for (Class c: throwableToSearchFor) {
                if (c.isAssignableFrom(throwableToSearchIn.getClass())) {
                    return true;
                }
            }
            throwableToSearchIn = throwableToSearchIn.getCause();
        }
        return false;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy