From 773ad5e8251a43b822793cb265a04a80793be4c7 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 16 Jul 2022 20:21:22 +0000 Subject: [PATCH] [github-356] accept some of the changes in this PR (not all) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902784 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/poi/examples/hsmf/Msg2txt.java | 2 +- .../org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java | 4 ++-- .../java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java | 2 +- .../java/org/apache/poi/ss/formula/eval/FunctionEval.java | 2 +- .../main/java/org/apache/poi/ss/formula/functions/MathX.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poi-examples/src/main/java/org/apache/poi/examples/hsmf/Msg2txt.java b/poi-examples/src/main/java/org/apache/poi/examples/hsmf/Msg2txt.java index 151cfc6fa0..5b4d48f142 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/hsmf/Msg2txt.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/hsmf/Msg2txt.java @@ -142,7 +142,7 @@ public class Msg2txt { * @param args the list of MSG files to process */ public static void main(String[] args) { - if(args.length <= 0) { + if(args.length == 0) { System.err.println("No files names provided"); } else { for (String arg : args) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java index 368f813b47..b446473f9d 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java @@ -110,7 +110,7 @@ public class XWPFHeaderFooterPolicy { CTHdrFtrRef ref = sectPr.getHeaderReferenceArray(i); POIXMLDocumentPart relatedPart = doc.getRelationById(ref.getId()); XWPFHeader hdr = null; - if (relatedPart != null && relatedPart instanceof XWPFHeader) { + if (relatedPart instanceof XWPFHeader) { hdr = (XWPFHeader) relatedPart; } // Assign it; treat invalid options as "default" POI-60293 @@ -128,7 +128,7 @@ public class XWPFHeaderFooterPolicy { CTHdrFtrRef ref = sectPr.getFooterReferenceArray(i); POIXMLDocumentPart relatedPart = doc.getRelationById(ref.getId()); XWPFFooter ftr = null; - if (relatedPart != null && relatedPart instanceof XWPFFooter) { + if (relatedPart instanceof XWPFFooter) { ftr = (XWPFFooter) relatedPart; } // Assign it; treat invalid options as "default" POI-60293 diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java index f9b2773de9..131c7d3d52 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java @@ -290,7 +290,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo */ public XWPFPictureData getPictureDataByID(String blipID) { POIXMLDocumentPart relatedPart = getRelationById(blipID); - if (relatedPart != null && relatedPart instanceof XWPFPictureData) { + if (relatedPart instanceof XWPFPictureData) { return (XWPFPictureData) relatedPart; } return null; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionEval.java index 6693cc5459..b314afd0fd 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionEval.java @@ -428,7 +428,7 @@ public final class FunctionEval { Collection lst = new TreeSet<>(); for (int i = 0; i < functions.length; i++) { Function func = functions[i]; - if (func != null && (func instanceof NotImplementedFunction)) { + if ((func instanceof NotImplementedFunction)) { FunctionMetadata metaData = FunctionMetadataRegistry.getFunctionByIndex(i); lst.add(metaData.getName()); } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java index 2df9e1f083..71c62883ff 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java @@ -414,7 +414,7 @@ final class MathX { */ public static double nChooseK(int n, int k) { double d = 1; - if (n<0 || k<0 || n