Skip to content

Commit

Permalink
Initialise Alert's method to an empty string
Browse files Browse the repository at this point in the history
The change prevents NullPointerException when testing for equality,
doing comparisons or obtaining the hash code if the alert no longer has
a message (thus the method was not being set to a non-null value).
  • Loading branch information
thc202 committed Aug 25, 2016
1 parent 89bc7f1 commit 0f345d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/org/parosproxy/paros/core/scanner/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// ZAP: 2016/02/26 Deprecate alert as an element of Alert in favour of name
// ZAP: 2016/05/25 Normalise equals/hashCode/compareTo
// ZAP: 2016/08/10 Issue 2757: Alerts with different request method are considered the same
// ZAP: 2016/08/25 Initialise the method to an empty string

package org.parosproxy.paros.core.scanner;

Expand Down Expand Up @@ -125,7 +126,7 @@ public class Alert implements Comparable<Alert> {
// ZAP: Added logger
private static final Logger logger = Logger.getLogger(Alert.class);
// Cache this info so that we dont have to keep a ref to the HttpMessage
private String method = null;
private String method = "";
private String postData;
private URI msgUri = null;

Expand Down

0 comments on commit 0f345d6

Please sign in to comment.