SasanLabs / owasp-zap-fileupload-addon

OWASP ZAP add-on for finding vulnerabilities in File Upload functionality.
Apache License 2.0
22 stars 6 forks source link

Fix exceptions with newer option #21

Closed thc202 closed 1 year ago

thc202 commented 1 year ago

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/:?]