Skip to content

Commit

Permalink
Bump client springboot version
Browse files Browse the repository at this point in the history
  • Loading branch information
Shoothzj committed Jan 3, 2022
1 parent 54291cc commit 4658097
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.nodes.MappingNode;
import org.yaml.snakeyaml.parser.ParserException;

import com.ctrip.framework.apollo.core.utils.StringUtils;
import org.yaml.snakeyaml.representer.Representer;

/**
* Transplanted from org.springframework.beans.factory.config.YamlProcessor since apollo can't depend on Spring directly
Expand Down Expand Up @@ -63,8 +66,15 @@ public void process(Properties properties, Map<String, Object> map) {
*/
private Yaml createYaml() {
StrictMapAppenderConstructor constructor = new StrictMapAppenderConstructor();
constructor.setAllowDuplicateKeys(false);
return new Yaml(constructor);
Representer representer = new Representer();
DumperOptions dumperOptions = new DumperOptions();
dumperOptions.setDefaultFlowStyle(representer.getDefaultFlowStyle());
dumperOptions.setDefaultScalarStyle(representer.getDefaultScalarStyle());
dumperOptions.setAllowReadOnlyProperties(representer.getPropertyUtils().isAllowReadOnlyProperties());
dumperOptions.setTimeZone(representer.getTimeZone());
LoaderOptions loadingConfig = new LoaderOptions();
loadingConfig.setAllowDuplicateKeys(false);
return new Yaml(constructor, representer, dumperOptions, loadingConfig);
}

private boolean process(MatchCallback callback, Yaml yaml, String content) {
Expand Down

0 comments on commit 4658097

Please sign in to comment.