fix lgtm issues

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1842216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2018-09-28 07:33:59 +00:00
parent e505160716
commit 500c64e657
5 changed files with 14 additions and 20 deletions

View File

@ -491,11 +491,14 @@ public final class XSSFCell implements Cell {
return cell.getCellFormula(fpb);
}
}
if (f.getT() == STCellFormulaType.SHARED) {
if (f == null) {
return null;
} else if (f.getT() == STCellFormulaType.SHARED) {
return convertSharedFormula((int)f.getSi(), fpb == null ? XSSFEvaluationWorkbook.create(getSheet().getWorkbook()) : fpb);
}
} else {
return f.getStringValue();
}
}
/**
* Creates a non shared formula from the shared formula counterpart

View File

@ -18,7 +18,6 @@
package org.apache.poi.xssf.usermodel;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Units;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
@ -154,12 +153,6 @@ public class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
// this.cell2 = calcCell(sheet, cell1, size.getCx(), size.getCy());
}
/**
*
* @param sheet
* @param cell starting point and offsets (may be zeros)
* @param size dimensions to calculate relative to starting point
*/
private CTMarker calcCell(CTMarker cell, long w, long h) {
CTMarker c2 = CTMarker.Factory.newInstance();

View File

@ -54,7 +54,7 @@ public class XSSFComment implements Comment {
// we potentially need to adjust the column/row information in the shape
// the same way as we do in setRow()/setColumn()
if(vmlShape != null && vmlShape.sizeOfClientDataArray() > 0) {
if(comment != null && vmlShape != null && vmlShape.sizeOfClientDataArray() > 0) {
CellReference ref = new CellReference(comment.getRef());
CTClientData clientData = vmlShape.getClientDataArray(0);
clientData.setRowArray(0, new BigInteger(String.valueOf(ref.getRow())));
@ -70,7 +70,7 @@ public class XSSFComment implements Comment {
*/
@Override
public String getAuthor() {
return _comments.getAuthor((int) _comment.getAuthorId());
return _comments.getAuthor(_comment.getAuthorId());
}
/**
@ -80,9 +80,7 @@ public class XSSFComment implements Comment {
*/
@Override
public void setAuthor(String author) {
_comment.setAuthorId(
_comments.findAuthor(author)
);
_comment.setAuthorId(_comments.findAuthor(author));
}
/**

View File

@ -2262,8 +2262,8 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
}
}
private void unsetCollapsed(boolean collapsed, CTCol ci) {
if (collapsed) {
private void unsetCollapsed(Boolean collapsed, CTCol ci) {
if (collapsed != null && collapsed.booleanValue()) {
ci.setCollapsed(collapsed);
} else {
ci.unsetCollapsed();
@ -2410,7 +2410,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
boolean endHidden = false;
int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx);
CTCol[] colArray = cols.getColArray();
if (endOfOutlineGroupIdx < colArray.length) {
if (endOfOutlineGroupIdx < (colArray.length - 1)) {
CTCol nextInfo = colArray[endOfOutlineGroupIdx + 1];
if (isAdjacentBefore(colArray[endOfOutlineGroupIdx], nextInfo)) {
endLevel = nextInfo.getOutlineLevel();