git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH JGIT] Equals method should not assume anything about the type of its argument
@ 2009-04-29 14:54 Sohn, Matthias
  2009-04-29 15:02 ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Sohn, Matthias @ 2009-04-29 14:54 UTC (permalink / raw)
  To: Shawn O. Pearce, Robin Rosenberg; +Cc: git

The equals(Object o) method shouldn't make any assumptions about the type of o. It should simply return false if o is not the same type as this.

Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
---
 .../src/org/spearce/jgit/lib/AnyObjectId.java      |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
index 2e3a43e..0bd2288 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
@@ -253,7 +253,11 @@ public boolean equals(final AnyObjectId other) {
 	}
 
 	public boolean equals(final Object o) {
-		return equals((AnyObjectId) o);
+		if (o instanceof AnyObjectId) {
+			return equals((AnyObjectId) o);
+		} else {
+			return false;
+		}
 	}
 
 	/**
-- 
1.6.2.2.1669.g7eaf8

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH JGIT] Equals method should not assume anything about the type of its argument
@ 2009-04-29 21:47 Sohn, Matthias
  2009-04-29 21:51 ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Sohn, Matthias @ 2009-04-29 21:47 UTC (permalink / raw)
  To: Shawn O. Pearce, Robin Rosenberg; +Cc: git

From: Matthias Sohn <matthias.sohn@sap.com>
The equals(Object o) method shouldn't make any assumptions about the
type of o. It should simply return false if o is not the same type as
this.

Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
---
Shawn Pearce <spearce@spearce.org> wrote:
> FWIW, your From header in the emails comes out "Sohn, Matthias"
> while your Signed-off-By is as above.  This means that when I slam
> your patch through git-am I get an author name of "Sohn, Matthias",
> which looks damn funny.  I have to remember to edit the patch after
> the fact to make it come out correct.
>
> Any change you can get your MUA to behave better?  Or is this
> Exchange enforcing a nice uniform standard... *sigh*

Didn't find a way to get around our Exchange server mangling the from header, 
hence trying to give From: in mail body. If this doesn't help I will issue a 
ticket for our Exchange administration to get this solved.

.../src/org/spearce/jgit/lib/AnyObjectId.java      |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
index 2e3a43e..acb3cb5 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
@@ -253,7 +253,10 @@ public boolean equals(final AnyObjectId other) {
 	}
 
 	public boolean equals(final Object o) {
-		return equals((AnyObjectId) o);
+		if (o instanceof AnyObjectId)
+			return equals((AnyObjectId) o);
+		else
+			return false;
 	}
 
 	/**
-- 
1.6.2.2.1669.g7eaf8

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-29 21:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-29 14:54 [PATCH JGIT] Equals method should not assume anything about the type of its argument Sohn, Matthias
2009-04-29 15:02 ` Shawn O. Pearce
  -- strict thread matches above, loose matches on Subject: below --
2009-04-29 21:47 Sohn, Matthias
2009-04-29 21:51 ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).