From: Axel Howind Date: Tue, 12 Nov 2019 15:47:46 +0000 (+0000) Subject: Replace AbstractWordUtils.equals with Objects.equals X-Git-Tag: REL_4_1_2~142 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0d4d57ace0f5a4d1dd986c78407936902b95fa5d;p=poi.git Replace AbstractWordUtils.equals with Objects.equals git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1869705 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java index a29bd305a0..6792c358f9 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java @@ -20,10 +20,7 @@ import java.io.File; 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 @@ public class AbstractWordUtils 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 @@ public class AbstractWordUtils 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 @@ public class AbstractWordUtils } } - static boolean equals( String str1, String str2 ) - { - return str1 == null ? str2 == null : str1.equals( str2 ); - } - public static String getBorderType( BorderCode borderCode ) { if ( borderCode == null ) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java index 91de8b1b40..784fb5028c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.Deque; import java.util.LinkedList; import java.util.List; +import java.util.Objects; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; @@ -200,7 +201,7 @@ public class WordToHtmlConverter extends AbstractWordConverter Triplet triplet = getCharacterRunTriplet( characterRun ); if ( AbstractWordUtils.isNotEmpty( triplet.fontName ) - && !AbstractWordUtils.equals( triplet.fontName, + && !Objects.equals( triplet.fontName, blockProperies.pFontName ) ) { style.append("font-family:").append(triplet.fontName).append(";");