Index: src/java/org/apache/poi/hssf/record/FontRecord.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/java/org/apache/poi/hssf/record/FontRecord.java (revision 6cf9e28fa7acdd2fd106769b649223fdfa3fc97e) +++ src/java/org/apache/poi/hssf/record/FontRecord.java (revision efb373e81a9f8bbfb8cf2f14a0507280ab807b15) @@ -23,6 +23,8 @@ import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.StringUtil; +import java.util.Objects; + /** * Title: Font Record (0x0031)

* - describes a font in the workbook (index = 0-3,5-infinity - skip 4)

@@ -479,16 +481,13 @@ field_6_underline == other.field_6_underline && field_7_family == other.field_7_family && field_8_charset == other.field_8_charset && - field_9_zero == other.field_9_zero && - stringEquals(this.field_11_font_name, other.field_11_font_name) + field_9_zero == other.field_9_zero && + Objects.equals(this.field_11_font_name, other.field_11_font_name) ; } public boolean equals(Object o) { return (o instanceof FontRecord) ? sameProperties((FontRecord)o) : false; } - - private static boolean stringEquals(String s1, String s2) { - return (s1 == s2 || (s1 != null && s1.equals(s2))); - } + } Index: src/java/org/apache/poi/hssf/util/HSSFColor.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/java/org/apache/poi/hssf/util/HSSFColor.java (revision 6cf9e28fa7acdd2fd106769b649223fdfa3fc97e) +++ src/java/org/apache/poi/hssf/util/HSSFColor.java (revision efb373e81a9f8bbfb8cf2f14a0507280ab807b15) @@ -17,11 +17,7 @@ package org.apache.poi.hssf.util; -import java.util.Collections; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; +import java.util.*; import org.apache.poi.ss.usermodel.Color; import org.apache.poi.util.Removal; @@ -343,7 +339,7 @@ if (index != hssfColor.index) return false; if (index2 != hssfColor.index2) return false; - return color != null ? color.equals(hssfColor.color) : hssfColor.color == null; + return Objects.equals(color, hssfColor.color); } @Override Index: src/java/org/apache/poi/ss/util/CellReference.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/java/org/apache/poi/ss/util/CellReference.java (revision 6cf9e28fa7acdd2fd106769b649223fdfa3fc97e) +++ src/java/org/apache/poi/ss/util/CellReference.java (revision efb373e81a9f8bbfb8cf2f14a0507280ab807b15) @@ -20,6 +20,7 @@ import static org.apache.poi.util.StringUtil.endsWithIgnoreCase; import java.util.Locale; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -577,9 +578,7 @@ && _colIndex == cr._colIndex && _isRowAbs == cr._isRowAbs && _isColAbs == cr._isColAbs - && ((_sheetName == null) - ? (cr._sheetName == null) - : _sheetName.equals(cr._sheetName)); + && (Objects.equals(_sheetName, cr._sheetName)); } @Override Index: src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java (revision 6cf9e28fa7acdd2fd106769b649223fdfa3fc97e) +++ src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java (revision efb373e81a9f8bbfb8cf2f14a0507280ab807b15) @@ -20,6 +20,8 @@ import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.util.Internal; +import java.util.Objects; + /** * This is a read only record that maintains information about * a hyperlink. In OOXML land, this information has to be merged @@ -87,7 +89,7 @@ XSSFHyperlinkRecord that = (XSSFHyperlinkRecord) o; - if (cellRangeAddress != null ? !cellRangeAddress.equals(that.cellRangeAddress) : that.cellRangeAddress != null) + if (!Objects.equals(cellRangeAddress, that.cellRangeAddress)) return false; if (relId != null ? !relId.equals(that.relId) : that.relId != null) return false; if (location != null ? !location.equals(that.location) : that.location != null) return false; Index: src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java (revision 6cf9e28fa7acdd2fd106769b649223fdfa3fc97e) +++ src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java (revision efb373e81a9f8bbfb8cf2f14a0507280ab807b15) @@ -20,10 +20,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; +import java.util.*; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.HWPFDocumentCore; @@ -101,8 +98,8 @@ Element element1 = (Element) node1; Element element2 = (Element) node2; - if ( !equals( requiredTagName, element1.getTagName() ) - || !equals( requiredTagName, element2.getTagName() ) ) + if ( !Objects.equals( requiredTagName, element1.getTagName() ) + || !Objects.equals( requiredTagName, element2.getTagName() ) ) return false; NamedNodeMap attributes1 = element1.getAttributes(); @@ -122,7 +119,7 @@ attr2 = (Attr) attributes2.getNamedItem( attr1.getName() ); if ( attr2 == null - || !equals( attr1.getTextContent(), attr2.getTextContent() ) ) + || !Objects.equals( attr1.getTextContent(), attr2.getTextContent() ) ) return false; } @@ -157,11 +154,6 @@ } } - static boolean equals( String str1, String str2 ) - { - return str1 == null ? str2 == null : str1.equals( str2 ); - } - public static String getBorderType( BorderCode borderCode ) { if ( borderCode == null )