Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.tika.sax.xpath;

import java.util.Objects;

/**
* Final evaluation state of a <code>.../@name</code> XPath expression.
* Matches the named attributes of the current element.
Expand All @@ -32,11 +34,6 @@ public NamedAttributeMatcher(String namespace, String name) {
}

public boolean matchesAttribute(String namespace, String name) {
return equals(namespace, this.namespace) && name.equals(this.name);
}

private static boolean equals(String a, String b) {
return (a == null) ? (b == null) : a.equals(b);
return Objects.equals(namespace, this.namespace) && name.equals(this.name);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.tika.sax.xpath;

import java.util.Objects;

/**
* Intermediate evaluation state of a <code>.../name...</code> XPath
* expression. Matches nothing, but specifies the evaluation state
Expand All @@ -34,15 +36,10 @@ protected NamedElementMatcher(String namespace, String name, Matcher then) {
}

public Matcher descend(String namespace, String name) {
if (equals(namespace, this.namespace) && name.equals(this.name)) {
if (Objects.equals(namespace, this.namespace) && name.equals(this.name)) {
return super.descend(namespace, name);
} else {
return FAIL;
}
}

private static boolean equals(String a, String b) {
return (a == null) ? (b == null) : a.equals(b);
}

}
22 changes: 16 additions & 6 deletions tika-eval/src/main/java/org/apache/tika/eval/EvalFilePaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;

/**
* Simple struct to keep track of relative path of source file (
Expand Down Expand Up @@ -74,16 +75,25 @@ public long getExtractFileLength() {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

EvalFilePaths that = (EvalFilePaths) o;

if (sourceFileLength != that.sourceFileLength) return false;
if (extractFileLength != that.extractFileLength) return false;
if (relativeSourceFilePath != null ? !relativeSourceFilePath.equals(that.relativeSourceFilePath) : that.relativeSourceFilePath != null)
if (sourceFileLength != that.sourceFileLength) {
return false;
}
if (extractFileLength != that.extractFileLength) {
return false;
}
if (!Objects.equals(relativeSourceFilePath, that.relativeSourceFilePath)) {
return false;
return extractFile != null ? extractFile.equals(that.extractFile) : that.extractFile == null;
}
return Objects.equals(extractFile, that.extractFile);

}

Expand Down
23 changes: 17 additions & 6 deletions tika-eval/src/main/java/org/apache/tika/eval/db/ColInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


import java.sql.Types;
import java.util.Objects;

public class ColInfo {
private final Cols name;
Expand Down Expand Up @@ -93,15 +94,25 @@ public String getSqlDef() {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

ColInfo colInfo = (ColInfo) o;

if (type != colInfo.type) return false;
if (name != colInfo.name) return false;
if (precision != null ? !precision.equals(colInfo.precision) : colInfo.precision != null) return false;
return !(constraints != null ? !constraints.equals(colInfo.constraints) : colInfo.constraints != null);
if (type != colInfo.type) {
return false;
}
if (name != colInfo.name) {
return false;
}
if (!Objects.equals(precision, colInfo.precision)) {
return false;
}
return Objects.equals(constraints, colInfo.constraints);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;

import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
Expand Down Expand Up @@ -333,14 +334,22 @@ public String getToken() {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

TokenDFTF tokenDFTF = (TokenDFTF) o;

if (df != tokenDFTF.df) return false;
if (tf != tokenDFTF.tf) return false;
return token != null ? token.equals(tokenDFTF.token) : tokenDFTF.token == null;
if (df != tokenDFTF.df) {
return false;
}
if (tf != tokenDFTF.tf) {
return false;
}
return Objects.equals(token, tokenDFTF.token);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,19 @@ private static class HtmlTag {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

HtmlTag htmlTag = (HtmlTag) o;

if (tag != null ? !tag.equals(htmlTag.tag) : htmlTag.tag != null) return false;
return clazz != null ? clazz.equals(htmlTag.clazz) : htmlTag.clazz == null;
if (!Objects.equals(tag, htmlTag.tag)) {
return false;
}
return Objects.equals(clazz, htmlTag.clazz);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

}

@Override
Expand Down