Skip to content

Error Handling in Directory Creation #1341

@DeHopen

Description

@DeHopen

@yegor256

In CheckstyleValidator.configuration():

if (!parent.exists() && !parent.mkdirs()) { throw new IllegalStateException( String.format( "Unable to create directories needed for %s", cache.getPath() ) ); }

  • Problem: If parent.exists() returns true but the directory is not actually writable, this will not be caught.

  • Consequence: Later file operations may fail.

  • Fix: Consider checking for writability as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions