{"thread":{"id":"19121","subject":"[PATCH JGIT] Equals method should not assume anything about the type of its argument","startedAt":"2009-04-29T14:54:44Z","lastAt":"2009-04-29T15:02:40Z","messageCount":2,"participants":["Sohn, Matthias","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"112638","messageId":"366BBB1215D0AB4B8A153AF047A287800302A6F9@dewdfe18.wdf.sap.corp","threadId":"19121","inReplyTo":null,"subject":"[PATCH JGIT] Equals method should not assume anything about the type of its argument","fromName":"Sohn, Matthias","fromEmail":"matthias.sohn@sap.com","sentAt":"2009-04-29T14:54:44Z","receivedAt":"2009-04-29T14:54:44Z","isPatch":true,"sender":{"key":"matthias.sohn@sap.com","avatar":"https://gravatar.com/avatar/88bbb2733bcb977ec2d2cc1916ba8a70d6d41432c146bb8dab4f7f802261194e?d=mp&s=160"},"body":"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.\n\nSigned-off-by: Matthias Sohn <matthias.sohn@sap.com>\n---\n .../src/org/spearce/jgit/lib/AnyObjectId.java      |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java\nindex 2e3a43e..0bd2288 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java\n@@ -253,7 +253,11 @@ public boolean equals(final AnyObjectId other) {\n \t}\n \n \tpublic boolean equals(final Object o) {\n-\t\treturn equals((AnyObjectId) o);\n+\t\tif (o instanceof AnyObjectId) {\n+\t\t\treturn equals((AnyObjectId) o);\n+\t\t} else {\n+\t\t\treturn false;\n+\t\t}\n \t}\n \n \t/**\n-- \n1.6.2.2.1669.g7eaf8\n"},{"id":"112639","messageId":"20090429150240.GB23604@spearce.org","threadId":"19121","inReplyTo":"366BBB1215D0AB4B8A153AF047A287800302A6F9@dewdfe18.wdf.sap.corp","subject":"Re: [PATCH JGIT] Equals method should not assume anything about the type of its argument","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-04-29T15:02:40Z","receivedAt":"2009-04-29T15:02:40Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Sohn, Matthias\" <matthias.sohn@sap.com> wrote:\n> 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.\n\nTrue.\n\nPlease line wrap your commit message at ~70 columns wide.\n \n> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>\n\nFWIW, your From header in the emails comes out \"Sohn, Matthias\"\nwhile your Signed-off-By is as above.  This means that when I slam\nyour patch through git-am I get an author name of \"Sohn, Matthias\",\nwhich looks damn funny.  I have to remember to edit the patch after\nthe fact to make it come out correct.\n\nAny change you can get your MUA to behave better?  Or is this\nExchange enforcing a nice uniform standard... *sigh*\n\n> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java\n> index 2e3a43e..0bd2288 100644\n> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java\n> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java\n> @@ -253,7 +253,11 @@ public boolean equals(final AnyObjectId other) {\n>  \t}\n>  \n>  \tpublic boolean equals(final Object o) {\n> -\t\treturn equals((AnyObjectId) o);\n> +\t\tif (o instanceof AnyObjectId) {\n> +\t\t\treturn equals((AnyObjectId) o);\n> +\t\t} else {\n> +\t\t\treturn false;\n> +\t\t}\n>  \t}\n\nStyle nit: We avoid unnecessary braces around clauses.\n\n-- \nShawn.\n"}]}