Author: fanningpj
Date: Fri Sep 28 07:33:59 2018
New Revision: 1842216
URL: http://svn.apache.org/viewvc?rev=1842216&view=rev
Log:
fix lgtm issues
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java?rev=1842216&r1=1842215&r2=1842216&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java Fri Sep
28 07:33:59 2018
@@ -98,7 +98,7 @@ public class StylesTable extends POIXMLD
if (num < 0) {
throw new IllegalArgumentException("Maximum Number of Data
Formats must be greater than or equal to 0");
} else {
- throw new IllegalStateException("Cannot set the maximum number
of data formats less than the current quantity." +
+ throw new IllegalStateException("Cannot set the maximum number
of data formats less than the current quantity. " +
"Data formats must be explicitly removed (via
StylesTable.removeNumberFormat) before the limit can be decreased.");
}
}
@@ -316,7 +316,7 @@ public class StylesTable extends POIXMLD
short nextKey = (short) (numberFormats.lastKey() + 1);
if (nextKey < 0) {
throw new IllegalStateException(
- "Cowardly avoiding creating a number format with a
negative id." +
+ "Cowardly avoiding creating a number format with a
negative id. " +
"This is probably due to arithmetic overflow.");
}
formatIndex = (short) Math.max(nextKey,
FIRST_USER_DEFINED_NUMBER_FORMAT_ID);
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=1842216&r1=1842215&r2=1842216&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java Fri
Sep 28 07:33:59 2018
@@ -491,10 +491,13 @@ public final class XSSFCell implements C
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();
}
- return f.getStringValue();
}
/**
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java?rev=1842216&r1=1842215&r2=1842216&view=diff
==============================================================================
---
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java
(original)
+++
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java
Fri Sep 28 07:33:59 2018
@@ -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 XS
// 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();
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java?rev=1842216&r1=1842215&r2=1842216&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java Fri
Sep 28 07:33:59 2018
@@ -54,7 +54,7 @@ public class XSSFComment implements Comm
// 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 Comm
*/
@Override
public String getAuthor() {
- return _comments.getAuthor((int) _comment.getAuthorId());
+ return _comments.getAuthor(_comment.getAuthorId());
}
/**
@@ -80,9 +80,7 @@ public class XSSFComment implements Comm
*/
@Override
public void setAuthor(String author) {
- _comment.setAuthorId(
- _comments.findAuthor(author)
- );
+ _comment.setAuthorId(_comments.findAuthor(author));
}
/**
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1842216&r1=1842215&r2=1842216&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Fri
Sep 28 07:33:59 2018
@@ -2262,8 +2262,8 @@ public class XSSFSheet extends POIXMLDoc
}
}
- 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 POIXMLDoc
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();
@@ -2900,7 +2900,7 @@ public class XSSFSheet extends POIXMLDoc
// "Got srcRows[" + (index-1) + "]=Row " +
prevRow.getRowNum() + ", srcRows[" + index + "]=Row " + curRow.getRowNum() +
".");
// FIXME: assumes row objects belong to non-null sheets and
sheets belong to non-null workbooks.
} else if (srcStartRow.getSheet().getWorkbook() !=
curRow.getSheet().getWorkbook()) {
- throw new IllegalArgumentException("All rows in srcRows must
belong to the same sheet in the same workbook." +
+ throw new IllegalArgumentException("All rows in srcRows must
belong to the same sheet in the same workbook. " +
"Expected all rows from same workbook (" +
srcStartRow.getSheet().getWorkbook() + "). " +
"Got srcRows[" + index + "] from different workbook ("
+ curRow.getSheet().getWorkbook() + ").");
} else if (srcStartRow.getSheet() != curRow.getSheet()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]