Index: /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/NTCredentials.java
===================================================================
--- /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/NTCredentials.java (revision 326187)
+++ /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/NTCredentials.java (working copy)
@@ -175,9 +175,8 @@
* @return true 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;
Index: /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
===================================================================
--- /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java (revision 326187)
+++ /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java (working copy)
@@ -194,13 +194,11 @@
* @return true 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)