You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Arseniy Tashoyan (Jira)" <ji...@apache.org> on 2020/04/23 14:25:00 UTC

[jira] [Commented] (CASSANDRA-15754) YamlConfigurationLoader swallows a real exception and exposes a misleading exception message

    [ https://issues.apache.org/jira/browse/CASSANDRA-15754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17090652#comment-17090652 ] 

Arseniy Tashoyan commented on CASSANDRA-15754:
----------------------------------------------

PR with fix: https://github.com/apache/cassandra/pull/560

> YamlConfigurationLoader swallows a real exception and exposes a misleading exception message
> --------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15754
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15754
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Local/Config
>            Reporter: Arseniy Tashoyan
>            Priority: Normal
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Method YamlConfigurationLoader.loadConfig(URL) parses a YAML config file:
> {code:java}
> try {
>   ...
>   Config result = loadConfig(yaml, configBytes);
>   ...
> }
> catch (YAMLException e) {
>   throw new ConfigurationException("Invalid yaml: " + url + SystemUtils.LINE_SEPARATOR + " Error: " + e.getMessage(), false);
> }
> {code}
> In the catch block, the real cause is dropped and a misleading message "Invalid yaml" is given. Instead in my case I have a cause:
> {code:none}
> java.lang.NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet()Ljava/util/Set;
> {code}
> This is caused by an incompatible Guava version in classpath. It was impossible to figure out the real root cause without debugging.
> One possible fix is to include the caught exception (YAMLException e) in the cause of the thrown exception:
> {code:java}
> throw new ConfigurationException(msg, e)
> {code}
> The 'msg' should be changed because it is not necessarily "Invalid yaml".
> Another possible fix is to not catch exception here - just let the root cause exception propagate to the caller.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org