sonar fixes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1713319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-11-08 23:14:50 +00:00
parent e8d108ff22
commit ccce28aae4
4 changed files with 10 additions and 28 deletions

View File

@ -125,7 +125,9 @@ public class KeyInfoSignatureFacet extends SignatureFacet {
};
Element n = document.getDocumentElement();
DOMSignContext domSignContext = new DOMSignContext(key, n, nextSibling);
DOMSignContext domSignContext = (nextSibling == null)
? new DOMSignContext(key, n)
: new DOMSignContext(key, n, nextSibling);
for (Map.Entry<String,String> me : signatureConfig.getNamespacePrefixes().entrySet()) {
domSignContext.putNamespacePrefix(me.getKey(), me.getValue());
}

View 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() {

View 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[])

View File

@ -232,7 +232,7 @@ public class XWPFTableCell implements IBody, ICell {
public XWPFVertAlign getVerticalAlignment() {
XWPFVertAlign vAlign = null;
CTTcPr tcpr = ctTc.getTcPr();
if (ctTc != null) {
if (tcpr != null) {
CTVerticalJc va = tcpr.getVAlign();
vAlign = stVertAlignTypeMap.get(va.getVal().intValue());
}
@ -488,11 +488,11 @@ public class XWPFTableCell implements IBody, ICell {
if (table == null) {
return null;
}
XWPFTableRow tableRow = table.getRow(row);
if (tableRow == null) {
XWPFTableRow tr = table.getRow(row);
if (tr == null) {
return null;
}
return tableRow.getTableCell(cell);
return tr.getTableCell(cell);
}
public XWPFDocument getXWPFDocument() {