You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by GitBox <gi...@apache.org> on 2020/11/07 07:54:34 UTC
[GitHub] [tika] PeterAlfredLee opened a new pull request #377: Simplify some equals statement by use Objects.equals
PeterAlfredLee opened a new pull request #377:
URL: https://github.com/apache/tika/pull/377
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tika] kkrugler commented on a change in pull request #377: Simplify some equals statement by use Objects.equals
Posted by GitBox <gi...@apache.org>.
kkrugler commented on a change in pull request #377:
URL: https://github.com/apache/tika/pull/377#discussion_r519186443
##########
File path: tika-eval/src/main/java/org/apache/tika/eval/EvalFilePaths.java
##########
@@ -81,9 +82,8 @@ public boolean equals(Object o) {
if (sourceFileLength != that.sourceFileLength) return false;
if (extractFileLength != that.extractFileLength) return false;
- if (relativeSourceFilePath != null ? !relativeSourceFilePath.equals(that.relativeSourceFilePath) : that.relativeSourceFilePath != null)
- return false;
- return extractFile != null ? extractFile.equals(that.extractFile) : that.extractFile == null;
+ if (!Objects.equals(relativeSourceFilePath, that.relativeSourceFilePath)) return false;
Review comment:
In general I think Tika uses a "always braces" style, so this would be better as:
```java
if (!blah) {
return false;
} else {
return Objects.equals(blah);
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tika] kkrugler merged pull request #377: Simplify some equals statement by use Objects.equals
Posted by GitBox <gi...@apache.org>.
kkrugler merged pull request #377:
URL: https://github.com/apache/tika/pull/377
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tika] kkrugler commented on a change in pull request #377: Simplify some equals statement by use Objects.equals
Posted by GitBox <gi...@apache.org>.
kkrugler commented on a change in pull request #377:
URL: https://github.com/apache/tika/pull/377#discussion_r519186522
##########
File path: tika-parser-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/PDFMarkedContent2XHTML.java
##########
@@ -500,8 +500,8 @@ public boolean equals(Object o) {
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);
Review comment:
Same comment as above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tika] PeterAlfredLee commented on a change in pull request #377: Simplify some equals statement by use Objects.equals
Posted by GitBox <gi...@apache.org>.
PeterAlfredLee commented on a change in pull request #377:
URL: https://github.com/apache/tika/pull/377#discussion_r519508954
##########
File path: tika-eval/src/main/java/org/apache/tika/eval/EvalFilePaths.java
##########
@@ -81,9 +82,8 @@ public boolean equals(Object o) {
if (sourceFileLength != that.sourceFileLength) return false;
if (extractFileLength != that.extractFileLength) return false;
- if (relativeSourceFilePath != null ? !relativeSourceFilePath.equals(that.relativeSourceFilePath) : that.relativeSourceFilePath != null)
- return false;
- return extractFile != null ? extractFile.equals(that.extractFile) : that.extractFile == null;
+ if (!Objects.equals(relativeSourceFilePath, that.relativeSourceFilePath)) return false;
Review comment:
Sure. And this is also the style I prefer. I made the `if` clause like this cause I want to have the same style as line 83, 84. Will modify all these 3 lines.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tika] kkrugler commented on a change in pull request #377: Simplify some equals statement by use Objects.equals
Posted by GitBox <gi...@apache.org>.
kkrugler commented on a change in pull request #377:
URL: https://github.com/apache/tika/pull/377#discussion_r519186475
##########
File path: tika-eval/src/main/java/org/apache/tika/eval/db/ColInfo.java
##########
@@ -100,8 +101,8 @@ public boolean equals(Object 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 (!Objects.equals(precision, colInfo.precision)) return false;
Review comment:
Same comment as above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org