]> source.dussan.org Git - poi.git/commitdiff
sonar fixes
authorAndreas Beeker <kiwiwings@apache.org>
Sun, 8 Nov 2015 23:14:50 +0000 (23:14 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sun, 8 Nov 2015 23:14:50 +0000 (23:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1713319 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/poifs/crypt/dsig/facets/KeyInfoSignatureFacet.java
src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java
src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java

index fca30abd921ecbebf91febb9a4f72890bb4347cc..27ea105330d3c8a966dcd854a54a1eb92b7c2c12 100644 (file)
@@ -125,7 +125,9 @@ public class KeyInfoSignatureFacet extends SignatureFacet {
         };\r
 \r
         Element n = document.getDocumentElement();\r
-        DOMSignContext domSignContext = new DOMSignContext(key, n, nextSibling);\r
+        DOMSignContext domSignContext = (nextSibling == null)\r
+            ? new DOMSignContext(key, n)\r
+            : new DOMSignContext(key, n, nextSibling);\r
         for (Map.Entry<String,String> me : signatureConfig.getNamespacePrefixes().entrySet()) {\r
             domSignContext.putNamespacePrefix(me.getKey(), me.getValue());\r
         }\r
index f5d29d3729ad5e51518ac668209a501132963183..574d64013aaad42aacf5f264a174c60a3ac11eb2 100644 (file)
@@ -65,14 +65,14 @@ public class XSSFXmlColumnPr {
         * @return the local XPath 
         */
        public String getLocalXPath(){
-               String localXPath = "";
+               StringBuilder localXPath = new StringBuilder();
                int numberOfCommonXPathAxis = table.getCommonXpath().split("/").length-1;
                
                String[] xPathTokens = ctXmlColumnPr.getXpath().split("/");
                for(int i=numberOfCommonXPathAxis; i<xPathTokens.length;i++){
-                       localXPath += "/" +xPathTokens[i];
+                       localXPath.append("/" +xPathTokens[i]);
                }
-               return localXPath;
+               return localXPath.toString();
        }
 
        public Enum getXmlDataType() {
index 8c0d2e63f48fb646f209bd107943ed0eb3f3c38e..4f210ae425ba65662a0da5f53bbcf4969e6d1d73 100644 (file)
@@ -247,26 +247,6 @@ public class XWPFHeaderFooterPolicy {
         return hdr;
     }
 
-    private CTHdrFtr buildHdrFtr(String pStyle, XWPFParagraph[] paragraphs) {
-        CTHdrFtr ftr = CTHdrFtr.Factory.newInstance();
-        if (paragraphs != null) {
-            for (int i = 0; i < paragraphs.length; i++) {
-                CTP p = ftr.addNewP();
-                //ftr.setPArray(0, paragraphs[i].getCTP());            // MB 23 May 2010
-                ftr.setPArray(i, paragraphs[i].getCTP());    // MB 23 May 2010
-            }
-        } else {
-            CTP p = ftr.addNewP();
-            byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
-            byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
-            p.setRsidP(rsidr);
-            p.setRsidRDefault(rsidrdefault);
-            CTPPr pPr = p.addNewPPr();
-            pPr.addNewPStyle().setVal(pStyle);
-        }
-        return ftr;
-    }
-
     /**
      * MB 24 May 2010. Created this overloaded buildHdrFtr() method because testing demonstrated
      * that the XWPFFooter or XWPFHeader object returned by calls to the createHeader(int, XWPFParagraph[])
index cc6ac3a2806c32404dd221fcaba2ce9810f378eb..adc04c26e743e1c527cdfc5ba81bf4c047d7099b 100644 (file)
@@ -232,7 +232,7 @@ public class XWPFTableCell implements IBody, ICell {
     public XWPFVertAlign getVerticalAlignment() {\r
         XWPFVertAlign vAlign = null;\r
         CTTcPr tcpr = ctTc.getTcPr();\r
-        if (ctTc != null) {\r
+        if (tcpr != null) {\r
             CTVerticalJc va = tcpr.getVAlign();\r
             vAlign = stVertAlignTypeMap.get(va.getVal().intValue());\r
         }\r
@@ -488,11 +488,11 @@ public class XWPFTableCell implements IBody, ICell {
         if (table == null) {\r
             return null;\r
         }\r
-        XWPFTableRow tableRow = table.getRow(row);\r
-        if (tableRow == null) {\r
+        XWPFTableRow tr = table.getRow(row);\r
+        if (tr == null) {\r
             return null;\r
         }\r
-        return tableRow.getTableCell(cell);\r
+        return tr.getTableCell(cell);\r
     }\r
 \r
     public XWPFDocument getXWPFDocument() {\r