Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ private ServiceDTO resolveConfigService() {

private List<ServiceDTO> getConfigServices() {
List<ServiceDTO> services = m_serviceLocator.getConfigServices();
if (services.size() == 0) {
if (services.isEmpty()) {
throw new ApolloConfigException("No available config service");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public void run() {

private List<ServiceDTO> getConfigServices() {
List<ServiceDTO> services = m_serviceLocator.getConfigServices();
if (services.size() == 0) {
if (services.isEmpty()) {
throw new ApolloConfigException("No available config service");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private <T> HttpResponse<T> doGetWithSerializeFunction(HttpRequest httpRequest,
conn.setRequestMethod("GET");

Map<String, String> headers = httpRequest.getHeaders();
if (headers != null && headers.size() > 0) {
if (headers != null && !headers.isEmpty()) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ private Yaml createYaml() {
private boolean process(MatchCallback callback, Yaml yaml, String content) {
int count = 0;
if (logger.isDebugEnabled()) {
logger.debug("Loading from YAML: " + content);
logger.debug("Loading from YAML: {}", content);
}
for (Object object : yaml.loadAll(content)) {
if (object != null && process(asMap(object), callback)) {
count++;
}
}
if (logger.isDebugEnabled()) {
logger.debug("Loaded " + count + " document" + (count > 1 ? "s" : "") + " from YAML resource: " + content);
logger.debug("Loaded {} document{} from YAML resource: {}", count, count > 1 ? "s" : "", content);
}
return (count > 0);
}
Expand Down Expand Up @@ -118,7 +118,7 @@ private boolean process(Map<String, Object> map, MatchCallback callback) {
properties.putAll(getFlattenedMap(map));

if (logger.isDebugEnabled()) {
logger.debug("Merging document (no matchers set): " + map);
logger.debug("Merging document (no matchers set): {}", map);
}
callback.process(properties, map);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ public void run() {
updateMetaServerAddresses(metaServerAddresses);
}
} catch (Throwable ex) {
logger
.warn(String.format("Refreshing meta server address failed, will retry in %d seconds",
REFRESH_INTERVAL_IN_SECOND), ex);
logger.warn("Refreshing meta server address failed, will retry in {} seconds", REFRESH_INTERVAL_IN_SECOND, ex);
}
}
}, REFRESH_INTERVAL_IN_SECOND, REFRESH_INTERVAL_IN_SECOND, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static String url2PathWithQuery(String urlString) {
String query = url.getQuery();

String pathWithQuery = path;
if (query != null && query.length() > 0) {
if (query != null && !query.isEmpty()) {
pathWithQuery += "?" + query;
}
return pathWithQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public boolean satisfy(Thread thread) {
return !thread.isAlive() || thread.isInterrupted() || thread.isDaemon();
}
});
if (alives.size() > 0) {
if (!alives.isEmpty()) {
log.info("Alive apollo threads: {}", alives);
try {
TimeUnit.SECONDS.sleep(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static Properties readConfigFile(String configPath, Properties defaults)

}
if (sb.length() > 0) {
logger.debug("Reading properties: \n" + sb);
logger.debug("Reading properties: \n{}", sb);
} else {
logger.warn("No available properties: {}", configPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class StringUtils {
* @return <code>true</code> if the String is empty or null
*/
public static boolean isEmpty(String str) {
return str == null || str.length() == 0;
return str == null || str.isEmpty();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public List<T> getContent() {
}

public boolean hasContent() {
return content != null && content.size() > 0;
return content != null && !content.isEmpty();
}

}
Loading