Skip to content

Commit d2f3258

Browse files
committed
fix coverity defect
1 parent 4e129e7 commit d2f3258

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

apollo-client/src/main/java/com/ctrip/framework/apollo/ds/ApolloDataSourceProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public DataSourcesDef defineDatasources() {
4646
String appId = Foundation.app().getAppId();
4747
String envType = Foundation.server().getEnvType();
4848

49-
if (file.hasContent()) {
49+
if (file != null && file.hasContent()) {
5050
String content = file.getContent();
5151

5252
m_logger.info(String.format("Found datasources.xml from Apollo(env=%s, app.id=%s)!", envType, appId));

apollo-client/src/main/java/com/ctrip/framework/apollo/internals/PlainTextConfigFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public PlainTextConfigFile(String namespace, ConfigRepository configRepository)
1212

1313
@Override
1414
public String getContent() {
15-
if (m_configProperties.get() == null) {
15+
if (!this.hasContent()) {
1616
return null;
1717
}
1818
return m_configProperties.get().getProperty(ConfigConsts.CONFIG_FILE_CONTENT_KEY);

apollo-client/src/main/java/com/ctrip/framework/apollo/internals/PropertiesConfigFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public String getContent() {
3434
}
3535

3636
String doGetContent() {
37-
if (m_configProperties.get() == null) {
37+
if (!this.hasContent()) {
3838
return null;
3939
}
4040

0 commit comments

Comments
 (0)