You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2005/10/19 22:51:52 UTC
svn commit: r326707 - in
/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient:
NTCredentials.java UsernamePasswordCredentials.java
Author: olegk
Date: Wed Oct 19 13:51:46 2005
New Revision: 326707
URL: http://svn.apache.org/viewcvs?rev=326707&view=rev
Log:
PR #37154 (UsernamePasswordCredentials.equals(null) throws NPE)
Contributed by Oleg Kalnichevski
Reviewed by Michael Becke
Modified:
jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/NTCredentials.java
jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/NTCredentials.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/NTCredentials.java?rev=326707&r1=326706&r2=326707&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/NTCredentials.java (original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/NTCredentials.java Wed Oct 19 13:51:46 2005
@@ -175,9 +175,8 @@
* @return <code>true</code> if all of the credentials match.
*/
public boolean equals(Object o) {
- if (this == o)
- return true;
-
+ if (o == null) return false;
+ if (this == o) return true;
if (super.equals(o) ) {
if (o instanceof NTCredentials) {
NTCredentials that = (NTCredentials) o;
Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java?rev=326707&r1=326706&r2=326707&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java (original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java Wed Oct 19 13:51:46 2005
@@ -194,13 +194,11 @@
* @return <code>true</code> if the object is equivalent.
*/
public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
-
+ if (o == null) return false;
+ if (this == o) return true;
// note - to allow for sub-classing, this checks that class is the same
// rather than do "instanceof".
- if (o.getClass() == this.getClass() ) {
+ if (this.getClass().equals(o.getClass())) {
UsernamePasswordCredentials that = (UsernamePasswordCredentials) o;
if (LangUtils.equals(this.userName, that.userName)
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org