Commit d2f32587 authored by Jason Song's avatar Jason Song

fix coverity defect

parent 4e129e70
...@@ -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;
} }
......
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