Skip to content

RuntimeUtils.msg(...) argument validation logic might be faulty #27

@Marcono1234

Description

@Marcono1234

It appears the argument validation logic in RuntimeUtils.msg(...) might be faulty:

if ( numArgs ==2 && numArgs != args.length+2 ){
throw new RuntimeException("Wrong argument count. The selector "+selName(selector)+" requires "+(numArgs-2)+" arguments, but received "+args.length);
}

I am not really familiar with this project, but I assume it should check for numArgs >= 2 (instead of == 2)?
Otherwise the calculation numArgs-2 in the error message is redundant because it would always be 0.

It might also be good to throw a more specific exception, e.g. IllegalArgumentException.
(Same for the other methods throwing RuntimeException when illegal arguments are provided)

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