Skip to content

Commit cfe16ad

Browse files
authored
Merge pull request #1601 from spencergibb/2.x-remove-exceptionutils-usage
Removes usage of ExceptionUtils
2 parents 9bb355e + 7ae2407 commit cfe16ad

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

eureka-client/src/main/java/com/netflix/discovery/DiscoveryClient.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959

6060
import com.netflix.discovery.shared.resolver.EndpointRandomizer;
6161
import com.netflix.discovery.shared.resolver.ResolverUtils;
62-
import org.apache.commons.lang.exception.ExceptionUtils;
6362
import org.slf4j.Logger;
6463
import org.slf4j.LoggerFactory;
6564

@@ -812,8 +811,8 @@ public Applications getApplications(String serviceUrl) {
812811
logger.info(PREFIX + "{} - was unable to refresh its cache! This periodic background refresh will be retried in {} seconds. status = {}",
813812
appPathIdentifier, clientConfig.getRegistryFetchIntervalSeconds(), response.getStatusCode());
814813
} catch (Throwable th) {
815-
logger.info(PREFIX + "{} - was unable to refresh its cache! This periodic background refresh will be retried in {} seconds. status = {} stacktrace = {}",
816-
appPathIdentifier, clientConfig.getRegistryFetchIntervalSeconds(), th.getMessage(), ExceptionUtils.getStackTrace(th));
814+
logger.info(String.format(PREFIX + "%s - was unable to refresh its cache! This periodic background refresh will be retried in %d seconds. status = %s",
815+
appPathIdentifier, clientConfig.getRegistryFetchIntervalSeconds(), th.getMessage()), th);
817816
}
818817
return null;
819818
}
@@ -965,8 +964,8 @@ private boolean fetchRegistry(boolean forceFullRegistryFetch) {
965964
applications.setAppsHashCode(applications.getReconcileHashCode());
966965
logTotalInstances();
967966
} catch (Throwable e) {
968-
logger.info(PREFIX + "{} - was unable to refresh its cache! This periodic background refresh will be retried in {} seconds. status = {} stacktrace = {}",
969-
appPathIdentifier, clientConfig.getRegistryFetchIntervalSeconds(), e.getMessage(), ExceptionUtils.getStackTrace(e));
967+
logger.info(String.format(PREFIX + "%s - was unable to refresh its cache! This periodic background refresh will be retried in %d seconds. status = %s",
968+
appPathIdentifier, clientConfig.getRegistryFetchIntervalSeconds(), e.getMessage()), e);
970969
return false;
971970
} finally {
972971
SpectatorUtil.record(FETCH_REGISTRY_TIMER, monotonicTime);

eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClient.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import com.netflix.discovery.shared.transport.TransportClientFactory;
3232
import com.netflix.discovery.shared.transport.TransportException;
3333
import com.netflix.discovery.shared.transport.TransportUtils;
34-
import org.apache.commons.lang.exception.ExceptionUtils;
3534
import org.slf4j.Logger;
3635
import org.slf4j.LoggerFactory;
3736

@@ -81,17 +80,17 @@ protected <R> EurekaHttpResponse<R> execute(RequestExecutor<R> requestExecutor)
8180
TransportUtils.shutdown(delegateRef.getAndSet(currentEurekaClientRef.get()));
8281
return response;
8382
} catch (Exception e) {
84-
logger.info("Request execution error. endpoint={}, exception={} stacktrace={}", serviceEndpoint,
85-
e.getMessage(), ExceptionUtils.getStackTrace(e));
83+
logger.info(String.format("Request execution error. endpoint=%s, exception=%s", serviceEndpoint,
84+
e.getMessage()), e);
8685
TransportUtils.shutdown(currentEurekaClientRef.get());
8786
throw e;
8887
}
8988
} else {
9089
try {
9190
return requestExecutor.execute(currentEurekaClient);
9291
} catch (Exception e) {
93-
logger.info("Request execution error. endpoint={} exception={} stacktrace={}", serviceEndpoint,
94-
e.getMessage(), ExceptionUtils.getStackTrace(e));
92+
logger.info(String.format("Request execution error. endpoint=%s exception=%s", serviceEndpoint,
93+
e.getMessage()), e);
9594
delegateRef.compareAndSet(currentEurekaClient, null);
9695
currentEurekaClient.shutdown();
9796
throw e;

0 commit comments

Comments
 (0)