Skip to content

Commit fe7d146

Browse files
committed
[AMORO-3940] Flink config load will cause ClassCastException when directly return result of Yaml load
1 parent f174d15 commit fe7d146

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

amoro-ams/src/main/java/org/apache/amoro/server/manager/FlinkOptimizerContainer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,14 @@ protected Map<String, String> loadFlinkConfigForYAML(URL path) {
275275
*/
276276
private Map<String, String> loadFlinkConfig() {
277277
try {
278+
Map<String, Object> configDocument;
278279
Path flinkConfPath = Paths.get(flinkConfDir + FLINK_CONFIG_YAML);
279280
if (!Files.exists(flinkConfPath, LinkOption.NOFOLLOW_LINKS)) {
280281
flinkConfPath = Paths.get(flinkConfDir + LEGACY_FLINK_CONFIG_YAML);
281-
return new Yaml().load(Files.newInputStream(flinkConfPath));
282+
configDocument = new Yaml().load(Files.newInputStream(flinkConfPath));
283+
} else {
284+
configDocument = YamlParserUtils.loadYamlFile(new File(flinkConfPath.toUri()));
282285
}
283-
Map<String, Object> configDocument =
284-
YamlParserUtils.loadYamlFile(new File(flinkConfPath.toUri()));
285286
return Maps.transformValues(
286287
flatten(configDocument, ""), value -> value == null ? null : value.toString());
287288
} catch (Exception e) {

0 commit comments

Comments
 (0)