Repository: nutch Updated Branches: refs/heads/2.x 54300a89e -> 4d63474d7
NUTCH-2346 Types are checked at object equality Project: http://git-wip-us.apache.org/repos/asf/nutch/repo Commit: http://git-wip-us.apache.org/repos/asf/nutch/commit/170f8c13 Tree: http://git-wip-us.apache.org/repos/asf/nutch/tree/170f8c13 Diff: http://git-wip-us.apache.org/repos/asf/nutch/diff/170f8c13 Branch: refs/heads/2.x Commit: 170f8c1375c8826c6397de0eb80e2fa29d2bfe5f Parents: 6e3c34d Author: kamaci <[email protected]> Authored: Mon Jan 9 17:40:04 2017 +0200 Committer: kamaci <[email protected]> Committed: Mon Jan 9 17:40:04 2017 +0200 ---------------------------------------------------------------------- src/java/org/apache/nutch/crawl/GeneratorJob.java | 8 ++++++++ src/java/org/apache/nutch/metadata/Metadata.java | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nutch/blob/170f8c13/src/java/org/apache/nutch/crawl/GeneratorJob.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/nutch/crawl/GeneratorJob.java b/src/java/org/apache/nutch/crawl/GeneratorJob.java index 1627590..3bfa249 100644 --- a/src/java/org/apache/nutch/crawl/GeneratorJob.java +++ b/src/java/org/apache/nutch/crawl/GeneratorJob.java @@ -119,6 +119,14 @@ public class GeneratorJob extends NutchTool implements Tool { @Override public boolean equals(Object obj) { + if (obj == null) { + return false; + } + + if (this.getClass() != obj.getClass()) { + return false; + } + SelectorEntry other = (SelectorEntry) obj; if (!url.equals(other.url)) return false; http://git-wip-us.apache.org/repos/asf/nutch/blob/170f8c13/src/java/org/apache/nutch/metadata/Metadata.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/nutch/metadata/Metadata.java b/src/java/org/apache/nutch/metadata/Metadata.java index 03c5db8..a56ec2b 100644 --- a/src/java/org/apache/nutch/metadata/Metadata.java +++ b/src/java/org/apache/nutch/metadata/Metadata.java @@ -190,13 +190,12 @@ public class Metadata implements Writable, CreativeCommons, DublinCore, return false; } - Metadata other = null; - try { - other = (Metadata) o; - } catch (ClassCastException cce) { + if (this.getClass() != o.getClass()) { return false; } + Metadata other = (Metadata) o; + if (other.size() != size()) { return false; }
