]> source.dussan.org Git - poi.git/commitdiff
[github-356] accept some of the changes in this PR (not all)
authorPJ Fanning <fanningpj@apache.org>
Sat, 16 Jul 2022 20:21:22 +0000 (20:21 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sat, 16 Jul 2022 20:21:22 +0000 (20:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902784 13f79535-47bb-0310-9956-ffa450edef68

poi-examples/src/main/java/org/apache/poi/examples/hsmf/Msg2txt.java
poi-ooxml/src/main/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java
poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionEval.java
poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java

index 151cfc6fa0a8a1f78c876484f02485ac3773eeee..5b4d48f142cdf645a7dbb9d0d2feff35c166535c 100644 (file)
@@ -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) {
index 368f813b474347ef375a8d636a84df87f62387ee..b446473f9d9b4f5577c58dbc0a86417e1645d03a 100644 (file)
@@ -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
index f9b2773de9eaec7ac611640b3e7aa64cd2203a83..131c7d3d5214b37df90d76a9f4572d2c2bcd1527 100644 (file)
@@ -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;
index 6693cc5459dec1ea0dfc7f6f4529a141b564b4a1..b314afd0fdae99c03141dfee7bc694921fd49b03 100644 (file)
@@ -428,7 +428,7 @@ public final class FunctionEval {
         Collection<String> 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());
             }
index 2df9e1f083600528434ed8cf55388aef6a7b50f9..71c62883ff0d08e29f87e5b65e02c1870aeba348 100644 (file)
@@ -414,7 +414,7 @@ final class MathX {
      */
     public static double nChooseK(int n, int k) {
         double d = 1;
-        if (n<0 || k<0 || n<k) {
+        if (k < 0 || n < k) {
             d= Double.NaN;
         }
         else {