Skip to content

[Bug]: YamlSnakeYamlFormatHandler catches Exception instead of specific types #200

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: cli
File: cli/format/YamlSnakeYamlFormatHandler.java (~line 175)
Severity: Medium

Summary

The catch block uses Exception instead of SnakeYAML-specific exceptions, potentially swallowing unexpected errors like ClassNotFoundException, SecurityException, etc.

catch (final Exception e) { // too broad
    throw new FormatParseException("Failed to parse YAML: " + e.getMessage(), e);
}

Suggested Fix

catch (final YAMLException | ClassCastException e) {
    throw new FormatParseException("Failed to parse YAML: " + e.getMessage(), e);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions