Skip to content

Commit a50bf52

Browse files
committed
RANGER-5549: addressed review suggestion
1 parent fcced65 commit a50bf52

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,11 @@ private static String getHostname() {
162162
try {
163163
hostname = InetAddress.getLocalHost().getHostName();
164164
} catch (Exception e) {
165-
LOG.error("ERROR: Unable to find hostname for the agent ", e);
166-
hostname = "unknownHost";
165+
LOG.error("ERROR: unable to find hostname", e);
167166
}
168167
}
169168
}
170169

171-
return hostname.trim();
170+
return StringUtils.isBlank(hostname) ? "unknownHost" : hostname.trim();
172171
}
173172
}

0 commit comments

Comments
 (0)