Skip to content

Commit

Permalink
Fix exceptions with newer option (#21)
Browse files Browse the repository at this point in the history
Load the option with the method that defaults to a given value when it
does not exist, otherwise this will lead to `NoSuchElementException`
until the option is set.
Also, use the primitive boolean which is the most appropriate type and
prevents `NullPointerException`s as it was null by default.

Signed-off-by: thc202 <[email protected]>
  • Loading branch information
thc202 authored Oct 21, 2023
1 parent 63ec7ba commit 1ea458a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to this add-on will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
### Fixed
- Fix exceptions using option introduced in previous version.

## [1.2.0] - 2023-10-19
- Ensure i18n resources are always initialized.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public FileUploadAttackExecutor(

public boolean executeAttack() throws FileUploadException {

Boolean shouldSendRequestsAfterFindingVulnerability =
boolean shouldSendRequestsAfterFindingVulnerability =
FileUploadConfiguration.getInstance().getSendRequestsAfterFindingVulnerability();

for (AttackVector attackVector : attackVectors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class FileUploadConfiguration extends VersionedAbstractParam {
private String parseResponseStartIdentifier;
private String parseResponseEndIdentifier;

private Boolean sendRequestsAfterFindingVulnerability;
private boolean sendRequestsAfterFindingVulnerability;

private static volatile FileUploadConfiguration fileUploadConfiguration;

Expand Down Expand Up @@ -109,7 +109,7 @@ public void setParseResponseEndIdentifier(String parseResponseEndIdentifier) {
parseResponseEndIdentifier);
}

public Boolean getSendRequestsAfterFindingVulnerability() {
public boolean getSendRequestsAfterFindingVulnerability() {
return sendRequestsAfterFindingVulnerability;
}

Expand Down Expand Up @@ -142,7 +142,7 @@ protected void parseImpl() {
this.setParseResponseEndIdentifier(
getConfig().getString(PARAM_PARSE_RESPONSE_CONFIGURATION_END_IDENTIFIER));
this.setSendRequestsAfterFindingVulnerability(
getConfig().getBoolean(PARAM_SEND_REQUESTS_AFTER_FINDING_VULNERABILITY_IDENTIFIER));
getBoolean(PARAM_SEND_REQUESTS_AFTER_FINDING_VULNERABILITY_IDENTIFIER, false));
}

@Override
Expand Down

0 comments on commit 1ea458a

Please sign in to comment.