Commit 1d3d0520 authored by 张乐's avatar 张乐 Committed by GitHub

Merge pull request #533 from nobodyiam/fix

fix coverity defect
parents 4e129e70 c3c18565
...@@ -46,7 +46,7 @@ public class ApolloDataSourceProvider implements DataSourceProvider, LogEnabled ...@@ -46,7 +46,7 @@ public class ApolloDataSourceProvider implements DataSourceProvider, LogEnabled
String appId = Foundation.app().getAppId(); String appId = Foundation.app().getAppId();
String envType = Foundation.server().getEnvType(); String envType = Foundation.server().getEnvType();
if (file.hasContent()) { if (file != null && file.hasContent()) {
String content = file.getContent(); String content = file.getContent();
m_logger.info(String.format("Found datasources.xml from Apollo(env=%s, app.id=%s)!", envType, appId)); m_logger.info(String.format("Found datasources.xml from Apollo(env=%s, app.id=%s)!", envType, appId));
......
...@@ -12,7 +12,7 @@ public abstract class PlainTextConfigFile extends AbstractConfigFile { ...@@ -12,7 +12,7 @@ public abstract class PlainTextConfigFile extends AbstractConfigFile {
@Override @Override
public String getContent() { public String getContent() {
if (m_configProperties.get() == null) { if (!this.hasContent()) {
return null; return null;
} }
return m_configProperties.get().getProperty(ConfigConsts.CONFIG_FILE_CONTENT_KEY); return m_configProperties.get().getProperty(ConfigConsts.CONFIG_FILE_CONTENT_KEY);
......
...@@ -34,7 +34,7 @@ public class PropertiesConfigFile extends AbstractConfigFile { ...@@ -34,7 +34,7 @@ public class PropertiesConfigFile extends AbstractConfigFile {
} }
String doGetContent() { String doGetContent() {
if (m_configProperties.get() == null) { if (!this.hasContent()) {
return null; return null;
} }
......
...@@ -330,7 +330,7 @@ public class NotificationControllerV2Test { ...@@ -330,7 +330,7 @@ public class NotificationControllerV2Test {
assertTrue(!anotherDeferredResult.hasResult()); assertTrue(!anotherDeferredResult.hasResult());
TimeUnit.MILLISECONDS.sleep(someBatchInterval * 3); TimeUnit.MILLISECONDS.sleep(someBatchInterval * 5);
assertTrue(anotherDeferredResult.hasResult()); assertTrue(anotherDeferredResult.hasResult());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment