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

Fix exceptions with newer option #21

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

thc202
Copy link
Contributor

@thc202 thc202 commented Oct 20, 2023

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 NullPointerExceptions as it was null by default.


e.g.

[ZAP-BootstrapGUI] ERROR org.parosproxy.paros.common.AbstractParam - 'fileupload.sendrequests' doesn't map to an existing object
java.util.NoSuchElementException: 'fileupload.sendrequests' doesn't map to an existing object
	at org.apache.commons.configuration.AbstractConfiguration.getBoolean(AbstractConfiguration.java:644) ~[commons-configuration-1.10.jar:1.10]
	at org.sasanlabs.fileupload.configuration.FileUploadConfiguration.parseImpl(FileUploadConfiguration.java:146) ~[?:?]
	at org.zaproxy.zap.common.VersionedAbstractParam.parse(VersionedAbstractParam.java:76) ~[main/:?]
	at org.parosproxy.paros.common.AbstractParam.load(AbstractParam.java:68) [main/:?]
[AWT-EventQueue-0] ERROR org.zaproxy.zap.ZAP.UncaughtExceptionLogger - Exception in thread "AWT-EventQueue-0"
java.lang.NullPointerException: null
	at org.sasanlabs.fileupload.ui.FileUploadOptionsPanel.initParam(FileUploadOptionsPanel.java:263) ~[?:?]
	at org.parosproxy.paros.view.AbstractParamContainerPanel.lambda$1(AbstractParamContainerPanel.java:662) ~[main/:?]
	at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
	at org.parosproxy.paros.view.AbstractParamContainerPanel.initParam(AbstractParamContainerPanel.java:662) ~[main/:?]

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 <thc202@gmail.com>
@preetkaran20 preetkaran20 merged commit 1ea458a into SasanLabs:main Oct 21, 2023
1 check passed
@thc202 thc202 deleted the error-config-parse branch October 21, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants