Skip to content

Commit

Permalink
Fix using dataids field causes NullPointerException (nacos-group#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guofuyinan authored Dec 29, 2023
1 parent 5a97a9d commit eaf15a6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.ListIterator;
import java.util.Properties;
import java.util.function.Function;
import java.util.stream.Collectors;

import com.alibaba.boot.nacos.config.properties.NacosConfigProperties;
import com.alibaba.nacos.api.config.ConfigService;
Expand All @@ -42,6 +43,7 @@

/**
* @author <a href="mailto:liaochunyhm@live.com">liaochuntao</a>
* @author <a href="mailto:guofuyinan@gmail.com">guofuyinan</a>
* @since 0.2.3
*/
public class NacosConfigLoader {
Expand Down Expand Up @@ -113,7 +115,9 @@ private List<NacosPropertySource> reqGlobalNacosConfig(ConfigurableEnvironment e
final String ids = environment
.resolvePlaceholders(nacosConfigProperties.getDataIds());
if(StringUtils.hasText(ids)){
dataIds.addAll(Arrays.asList(ids.split(",")));
dataIds.addAll(Arrays.stream(ids.split(","))
.filter(StringUtils::hasText)
.collect(Collectors.toList()));
}
}
else {
Expand Down

0 comments on commit eaf15a6

Please sign in to comment.