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 extends Throwable> c: throwableToSearchFor) {
if (c.isAssignableFrom(throwableToSearchIn.getClass())) {
return true;
}
}
throwableToSearchIn = throwableToSearchIn.getCause();
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy