Commit d2f32587 by Jason Song

fix coverity defect

parent 4e129e70
......@@ -46,7 +46,7 @@ public class ApolloDataSourceProvider implements DataSourceProvider, LogEnabled
String appId = Foundation.app().getAppId();
String envType = Foundation.server().getEnvType();
if (file.hasContent()) {
if (file != null && file.hasContent()) {
String content = file.getContent();
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 {
@Override
public String getContent() {
if (m_configProperties.get() == null) {
if (!this.hasContent()) {
return null;
}
return m_configProperties.get().getProperty(ConfigConsts.CONFIG_FILE_CONTENT_KEY);
......
......@@ -34,7 +34,7 @@ public class PropertiesConfigFile extends AbstractConfigFile {
}
String doGetContent() {
if (m_configProperties.get() == null) {
if (!this.hasContent()) {
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