Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Risk of NullPointerException Due to Use of Boxed Boolean in toPath Method #554

Open
tanmaysharma2001 opened this issue Apr 10, 2024 · 1 comment · May be fixed by #555
Open

Risk of NullPointerException Due to Use of Boxed Boolean in toPath Method #554

tanmaysharma2001 opened this issue Apr 10, 2024 · 1 comment · May be fixed by #555
Labels

Comments

@tanmaysharma2001
Copy link

I've noticed a potential issue in the FileTarget.java file where a boxed Boolean is used directly in a boolean expression. This occurs in the toPath method, specifically at this line. The use of a boxed Boolean (this.overwrite) in a conditional check might lead to a NullPointerException if the Boolean object is null.

Potential Impact

In cases where this.overwrite is null, attempting to evaluate it in a boolean context (if (this.overwrite)) will throw a NullPointerException, leading to unexpected crashes or behavior.

A much compliant solution here will be to use a Primitive Boolean Expression.

@yegor256 Can you please approve this issue?

@yegor256
Copy link
Member

@tanmaysharma2001 yes, we can change the type of the attribute to simply boolean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants