Skip to content

Commit

Permalink
Use Strings.trim
Browse files Browse the repository at this point in the history
  • Loading branch information
smola committed Dec 1, 2022
1 parent 5d5a218 commit b43facf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal-api/src/main/java/datadog/trace/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
import datadog.trace.bootstrap.config.provider.CapturedEnvironmentConfigSource;
import datadog.trace.bootstrap.config.provider.ConfigProvider;
import datadog.trace.bootstrap.config.provider.SystemPropertiesConfigSource;
import datadog.trace.util.Strings;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.BufferedReader;
import java.io.IOException;
Expand Down Expand Up @@ -2464,9 +2465,10 @@ static String initHostName() {
} catch (Throwable t) {
// Ignore
}
if (possibleHostname != null && !possibleHostname.trim().isEmpty()) {
possibleHostname = Strings.trim(possibleHostname);
if (!possibleHostname.isEmpty()) {
log.debug("Determined hostname from file {}", hostNameFile);
return possibleHostname.trim();
return possibleHostname;
}
}

Expand Down

0 comments on commit b43facf

Please sign in to comment.