zhyyu opened a new issue #8029: URL: https://github.com/apache/skywalking/issues/8029
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues. ### Apache SkyWalking Component OAP server (apache/skywalking) ### What happened I use `SW_ES_PASSWORD` env to inject es password, the pwd contain special character like `!AI!3B`. And when I start the OAP, it occurs error, and fail start up. ``` 2021-10-28 10:57:55,024 - org.apache.skywalking.oap.server.starter.OAPServerBootstrap - 61 [main] ERROR [] - while parsing a node in 'string', line 1, column 1: !AI!3B ^ found undefined tag handle !AI! in 'string', line 1, column 1: !AI!3B ^ org.yaml.snakeyaml.parser.ParserException: while parsing a node in 'string', line 1, column 1: !AI!3B ^ found undefined tag handle !AI! in 'string', line 1, column 1: !AI!3B ^ at org.yaml.snakeyaml.parser.ParserImpl.parseNode(ParserImpl.java:411) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.parser.ParserImpl.access$1300(ParserImpl.java:116) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockNode.produce(ParserImpl.java:358) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:157) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:147) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:133) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:122) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:505) ~[snakeyaml-1.18.jar:?] at org.yaml.snakeyaml.Yaml.load(Yaml.java:424) ~[snakeyaml-1.18.jar:?] at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoader.replacePropertyAndLog(ApplicationConfigLoader.java:122) ~[classes/:?] at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoader.lambda$null$1(ApplicationConfigLoader.java:93) ~[classes/:?] at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[?:1.8.0_282] at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoader.lambda$null$2(ApplicationConfigLoader.java:83) ~[classes/:?] at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[?:1.8.0_282] at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoader.lambda$loadConfig$3(ApplicationConfigLoader.java:75) ~[classes/:?] at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[?:1.8.0_282] at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoader.loadConfig(ApplicationConfigLoader.java:70) ~[classes/:?] at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoader.load(ApplicationConfigLoader.java:52) ~[classes/:?] at org.apache.skywalking.oap.server.starter.OAPServerBootstrap.start(OAPServerBootstrap.java:46) [classes/:?] at org.apache.skywalking.oap.server.starter.OAPServerStartUp.main(OAPServerStartUp.java:27) [classes/:?] ``` ### What you expected to happen Config can inject env which contain special character(like !), and start up successfully. ### How to reproduce Set `SW_ES_PASSWORD` env to some special string like `!AI!3B`, and start up the OAP, then it will occur yaml parse node error. ### Anything else I checked the code and found in `ApplicationConfigLoader` class ```java private void replacePropertyAndLog(final Object propertyName, final Object propertyValue, final Properties target, final Object providerName) { final String valueString = PropertyPlaceholderHelper.INSTANCE .replacePlaceholders(propertyValue + "", target); if (valueString != null) { if (valueString.trim().length() == 0) { target.replace(propertyName, valueString); log.info("Provider={} config={} has been set as an empty string", providerName, propertyName); } else { // Use YAML to do data type conversion. final Object replaceValue = yaml.load(valueString); if (replaceValue != null) { target.replace(propertyName, replaceValue); log.info( "Provider={} config={} has been set as {}", providerName, propertyName, replaceValue.toString() ); } } } } ``` the line `final Object replaceValue = yaml.load(valueString);` lead this error, when valuesString contains some special character like (!), yaml parse error. ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
