aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/examples/src/org/apache/poi/hssf/view/SVTableUtils.java4
-rw-r--r--src/examples/src/org/apache/poi/ss/examples/LinkedDropDownLists.java2
-rw-r--r--src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/CFHeaderBase.java10
-rw-r--r--src/java/org/apache/poi/hssf/record/ExtSSTRecord.java4
-rw-r--r--src/java/org/apache/poi/hssf/record/GridsetRecord.java32
-rw-r--r--src/java/org/apache/poi/hssf/record/HCenterRecord.java30
-rw-r--r--src/java/org/apache/poi/hssf/record/NameRecord.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/PrecisionRecord.java36
-rw-r--r--src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java37
-rw-r--r--src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java36
-rw-r--r--src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java28
-rw-r--r--src/java/org/apache/poi/hssf/util/HSSFColor.java4
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/DStarRunner.java42
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/ImReal.java2
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/Imaginary.java2
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java2
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/NumericFunction.java4
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/Rate.java2
-rw-r--r--src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java2
-rw-r--r--src/java/org/apache/poi/ss/usermodel/DataFormatter.java2
-rw-r--r--src/java/org/apache/poi/ss/usermodel/FormulaError.java2
-rw-r--r--src/java/org/apache/poi/ss/util/SheetBuilder.java16
-rw-r--r--src/java/org/apache/poi/ss/util/WorkbookUtil.java4
-rw-r--r--src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java10
-rw-r--r--src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java1
-rw-r--r--src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/RevocationData.java4
-rw-r--r--src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFShape.java4
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java7
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBuiltinTableStyle.java2
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java1
-rw-r--r--src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java11
-rw-r--r--src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSDTContent.java2
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java21
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java43
-rw-r--r--src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java1
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java2
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java2
-rw-r--r--src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java4
-rw-r--r--src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java12
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java4
47 files changed, 175 insertions, 284 deletions
diff --git a/src/examples/src/org/apache/poi/hssf/view/SVTableUtils.java b/src/examples/src/org/apache/poi/hssf/view/SVTableUtils.java
index 4ec32944d5..1a9fbf813a 100644
--- a/src/examples/src/org/apache/poi/hssf/view/SVTableUtils.java
+++ b/src/examples/src/org/apache/poi/hssf/view/SVTableUtils.java
@@ -70,7 +70,7 @@ public class SVTableUtils {
/** This method retrieves the AWT Color representation from the colour hash table
*
*/
- /* package */ static final Color getAWTColor(int index, Color deflt) {
+ /* package */ static Color getAWTColor(int index, Color deflt) {
HSSFColor clr = colors.get(index);
if (clr == null) {
return deflt;
@@ -79,7 +79,7 @@ public class SVTableUtils {
return new Color(rgb[0],rgb[1],rgb[2]);
}
- /* package */ static final Color getAWTColor(HSSFColorPredefined clr) {
+ /* package */ static Color getAWTColor(HSSFColorPredefined clr) {
short[] rgb = clr.getTriplet();
return new Color(rgb[0],rgb[1],rgb[2]);
}
diff --git a/src/examples/src/org/apache/poi/ss/examples/LinkedDropDownLists.java b/src/examples/src/org/apache/poi/ss/examples/LinkedDropDownLists.java
index 8f43b4bf66..4e29e8f852 100644
--- a/src/examples/src/org/apache/poi/ss/examples/LinkedDropDownLists.java
+++ b/src/examples/src/org/apache/poi/ss/examples/LinkedDropDownLists.java
@@ -132,7 +132,7 @@ public class LinkedDropDownLists {
* @param dataSheet An instance of a class that implements the Sheet Sheet
* interface (HSSFSheet or XSSFSheet).
*/
- private static final void buildDataSheet(Sheet dataSheet) {
+ private static void buildDataSheet(Sheet dataSheet) {
Row row = null;
Cell cell = null;
Name name = null;
diff --git a/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java b/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java
index 2bad961bdb..e348d964e0 100644
--- a/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java
+++ b/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java
@@ -62,7 +62,7 @@ public class HPSFFileHandler extends POIFSFileHandler {
);
- private static final Set<String> unmodifiableHashSet(String... a) {
+ private static Set<String> unmodifiableHashSet(String... a) {
return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(a)));
}
diff --git a/src/java/org/apache/poi/hssf/record/CFHeaderBase.java b/src/java/org/apache/poi/hssf/record/CFHeaderBase.java
index 015917e25e..f4c1fbe87f 100644
--- a/src/java/org/apache/poi/hssf/record/CFHeaderBase.java
+++ b/src/java/org/apache/poi/hssf/record/CFHeaderBase.java
@@ -67,7 +67,9 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
// held on the first bit
if (b == getNeedRecalculation()) {
return;
- } else if (b) {
+ }
+
+ if (b) {
field_2_need_recalculation_and_id++;
} else {
field_2_need_recalculation_and_id--;
@@ -105,8 +107,7 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
}
CellRangeAddressList cral = new CellRangeAddressList();
CellRangeAddress enclosingRange = null;
- for (int i = 0; i < cellRanges.length; i++) {
- CellRangeAddress cr = cellRanges[i];
+ for (CellRangeAddress cr : cellRanges) {
enclosingRange = CellRangeUtil.createEnclosingCellRange(cr, enclosingRange);
cral.addCellRangeAddress(cr);
}
@@ -119,8 +120,9 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
}
protected abstract String getRecordName();
+
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("[").append(getRecordName()).append("]\n");
buffer.append("\t.numCF = ").append(getNumberOfConditionalFormats()).append("\n");
diff --git a/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java b/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java
index 8660d97895..e0b975d088 100644
--- a/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java
@@ -148,7 +148,7 @@ public final class ExtSSTRecord extends ContinuableRecord {
return _sstInfos;
}
- public static final int getNumberOfInfoRecsForStrings(int numStrings) {
+ public static int getNumberOfInfoRecsForStrings(int numStrings) {
int infoRecs = (numStrings / DEFAULT_BUCKET_SIZE);
if ((numStrings % DEFAULT_BUCKET_SIZE) != 0)
infoRecs ++;
@@ -166,7 +166,7 @@ public final class ExtSSTRecord extends ContinuableRecord {
*
* @return the size of the extsst record
*/
- public static final int getRecordSizeForStrings(int numStrings) {
+ public static int getRecordSizeForStrings(int numStrings) {
return 4 + 2 + getNumberOfInfoRecsForStrings(numStrings) * 8;
}
diff --git a/src/java/org/apache/poi/hssf/record/GridsetRecord.java b/src/java/org/apache/poi/hssf/record/GridsetRecord.java
index 14f04ab2ab..570ebe2867 100644
--- a/src/java/org/apache/poi/hssf/record/GridsetRecord.java
+++ b/src/java/org/apache/poi/hssf/record/GridsetRecord.java
@@ -15,8 +15,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndianOutput;
@@ -33,13 +31,11 @@ import org.apache.poi.util.LittleEndianOutput;
*
* @version 2.0-pre
*/
-
public final class GridsetRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x82;
public short field_1_gridset_flag;
- public GridsetRecord()
- {
+ public GridsetRecord() {
}
public GridsetRecord(RecordInputStream in)
@@ -52,15 +48,10 @@ public final class GridsetRecord extends StandardRecord implements Cloneable {
*
* @param gridset - <b>true</b> if no gridlines are print, <b>false</b> if gridlines are not print.
*/
-
- public void setGridset(boolean gridset)
- {
- if (gridset == true)
- {
+ public void setGridset(boolean gridset) {
+ if (gridset) {
field_1_gridset_flag = 1;
- }
- else
- {
+ } else {
field_1_gridset_flag = 0;
}
}
@@ -70,21 +61,16 @@ public final class GridsetRecord extends StandardRecord implements Cloneable {
*
* @return gridset - true if gridlines are NOT printed, false if they are.
*/
-
public boolean getGridset()
{
return (field_1_gridset_flag == 1);
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[GRIDSET]\n");
- buffer.append(" .gridset = ").append(getGridset())
- .append("\n");
- buffer.append("[/GRIDSET]\n");
- return buffer.toString();
+ public String toString() {
+ return "[GRIDSET]\n" +
+ " .gridset = " + getGridset() +
+ "\n" +
+ "[/GRIDSET]\n";
}
public void serialize(LittleEndianOutput out) {
diff --git a/src/java/org/apache/poi/hssf/record/HCenterRecord.java b/src/java/org/apache/poi/hssf/record/HCenterRecord.java
index 604ddeae28..d050823a6f 100644
--- a/src/java/org/apache/poi/hssf/record/HCenterRecord.java
+++ b/src/java/org/apache/poi/hssf/record/HCenterRecord.java
@@ -14,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndianOutput;
@@ -31,8 +30,7 @@ public final class HCenterRecord extends StandardRecord implements Cloneable {
public final static short sid = 0x0083;
private short field_1_hcenter;
- public HCenterRecord()
- {
+ public HCenterRecord() {
}
public HCenterRecord(RecordInputStream in)
@@ -44,15 +42,10 @@ public final class HCenterRecord extends StandardRecord implements Cloneable {
* set whether or not to horizonatally center this sheet.
* @param hc center - t/f
*/
-
- public void setHCenter(boolean hc)
- {
- if (hc == true)
- {
+ public void setHCenter(boolean hc) {
+ if (hc) {
field_1_hcenter = 1;
- }
- else
- {
+ } else {
field_1_hcenter = 0;
}
}
@@ -61,21 +54,16 @@ public final class HCenterRecord extends StandardRecord implements Cloneable {
* get whether or not to horizonatally center this sheet.
* @return center - t/f
*/
-
public boolean getHCenter()
{
return (field_1_hcenter == 1);
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[HCENTER]\n");
- buffer.append(" .hcenter = ").append(getHCenter())
- .append("\n");
- buffer.append("[/HCENTER]\n");
- return buffer.toString();
+ public String toString() {
+ return "[HCENTER]\n" +
+ " .hcenter = " + getHCenter() +
+ "\n" +
+ "[/HCENTER]\n";
}
public void serialize(LittleEndianOutput out) {
diff --git a/src/java/org/apache/poi/hssf/record/NameRecord.java b/src/java/org/apache/poi/hssf/record/NameRecord.java
index 050745b259..e4331c00f5 100644
--- a/src/java/org/apache/poi/hssf/record/NameRecord.java
+++ b/src/java/org/apache/poi/hssf/record/NameRecord.java
@@ -66,7 +66,7 @@ public final class NameRecord extends ContinuableRecord {
public static final int OPT_COMPLEX = 0x0010;
public static final int OPT_BUILTIN = 0x0020;
public static final int OPT_BINDATA = 0x1000;
- public static final boolean isFormula(int optValue) {
+ public static boolean isFormula(int optValue) {
return (optValue & 0x0F) == 0;
}
}
diff --git a/src/java/org/apache/poi/hssf/record/PrecisionRecord.java b/src/java/org/apache/poi/hssf/record/PrecisionRecord.java
index 0dede18379..74bf8cf916 100644
--- a/src/java/org/apache/poi/hssf/record/PrecisionRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PrecisionRecord.java
@@ -15,8 +15,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndianOutput;
@@ -28,15 +26,11 @@ import org.apache.poi.util.LittleEndianOutput;
* REFERENCE: PG 372 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @version 2.0-pre
*/
-
-public final class PrecisionRecord
- extends StandardRecord
-{
+public final class PrecisionRecord extends StandardRecord {
public final static short sid = 0xE;
public short field_1_precision;
- public PrecisionRecord()
- {
+ public PrecisionRecord() {
}
public PrecisionRecord(RecordInputStream in)
@@ -49,15 +43,10 @@ public final class PrecisionRecord
*
* @param fullprecision - or not
*/
-
- public void setFullPrecision(boolean fullprecision)
- {
- if (fullprecision == true)
- {
+ public void setFullPrecision(boolean fullprecision) {
+ if (fullprecision) {
field_1_precision = 1;
- }
- else
- {
+ } else {
field_1_precision = 0;
}
}
@@ -67,21 +56,16 @@ public final class PrecisionRecord
*
* @return fullprecision - or not
*/
-
public boolean getFullPrecision()
{
return (field_1_precision == 1);
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[PRECISION]\n");
- buffer.append(" .precision = ").append(getFullPrecision())
- .append("\n");
- buffer.append("[/PRECISION]\n");
- return buffer.toString();
+ public String toString() {
+ return "[PRECISION]\n" +
+ " .precision = " + getFullPrecision() +
+ "\n" +
+ "[/PRECISION]\n";
}
public void serialize(LittleEndianOutput out) {
diff --git a/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java b/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java
index b22e244853..2563f34326 100644
--- a/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndianOutput;
@@ -29,15 +26,11 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
-
-public final class PrintGridlinesRecord
- extends StandardRecord
-{
+public final class PrintGridlinesRecord extends StandardRecord {
public final static short sid = 0x2b;
private short field_1_print_gridlines;
- public PrintGridlinesRecord()
- {
+ public PrintGridlinesRecord() {
}
public PrintGridlinesRecord(RecordInputStream in)
@@ -50,15 +43,10 @@ public final class PrintGridlinesRecord
*
* @param pg make spreadsheet ugly - Y/N
*/
-
- public void setPrintGridlines(boolean pg)
- {
- if (pg == true)
- {
+ public void setPrintGridlines(boolean pg) {
+ if (pg) {
field_1_print_gridlines = 1;
- }
- else
- {
+ } else {
field_1_print_gridlines = 0;
}
}
@@ -68,21 +56,16 @@ public final class PrintGridlinesRecord
*
* @return make spreadsheet ugly - Y/N
*/
-
public boolean getPrintGridlines()
{
return (field_1_print_gridlines == 1);
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[PRINTGRIDLINES]\n");
- buffer.append(" .printgridlines = ").append(getPrintGridlines())
- .append("\n");
- buffer.append("[/PRINTGRIDLINES]\n");
- return buffer.toString();
+ public String toString() {
+ return "[PRINTGRIDLINES]\n" +
+ " .printgridlines = " + getPrintGridlines() +
+ "\n" +
+ "[/PRINTGRIDLINES]\n";
}
public void serialize(LittleEndianOutput out) {
diff --git a/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java b/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java
index f2287ee6fc..607c4a8b7c 100644
--- a/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java
@@ -15,8 +15,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndianOutput;
@@ -30,15 +28,11 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
-
-public final class PrintHeadersRecord
- extends StandardRecord
-{
+public final class PrintHeadersRecord extends StandardRecord {
public final static short sid = 0x2a;
private short field_1_print_headers;
- public PrintHeadersRecord()
- {
+ public PrintHeadersRecord() {
}
public PrintHeadersRecord(RecordInputStream in)
@@ -50,15 +44,10 @@ public final class PrintHeadersRecord
* set to print the headers - y/n
* @param p printheaders or not
*/
-
- public void setPrintHeaders(boolean p)
- {
- if (p == true)
- {
+ public void setPrintHeaders(boolean p) {
+ if (p) {
field_1_print_headers = 1;
- }
- else
- {
+ } else {
field_1_print_headers = 0;
}
}
@@ -67,21 +56,16 @@ public final class PrintHeadersRecord
* get whether to print the headers - y/n
* @return printheaders or not
*/
-
public boolean getPrintHeaders()
{
return (field_1_print_headers == 1);
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[PRINTHEADERS]\n");
- buffer.append(" .printheaders = ").append(getPrintHeaders())
- .append("\n");
- buffer.append("[/PRINTHEADERS]\n");
- return buffer.toString();
+ public String toString() {
+ return "[PRINTHEADERS]\n" +
+ " .printheaders = " + getPrintHeaders() +
+ "\n" +
+ "[/PRINTHEADERS]\n";
}
public void serialize(LittleEndianOutput out) {
diff --git a/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java b/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java
index 96cfde27c7..05c66f78f0 100644
--- a/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java
@@ -15,8 +15,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndianOutput;
@@ -29,15 +27,13 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
-
public final class SaveRecalcRecord
extends StandardRecord
{
public final static short sid = 0x5f;
private short field_1_recalc;
- public SaveRecalcRecord()
- {
+ public SaveRecalcRecord() {
}
public SaveRecalcRecord(RecordInputStream in)
@@ -49,32 +45,24 @@ public final class SaveRecalcRecord
* set whether to recalculate formulas/etc before saving or not
* @param recalc - whether to recalculate or not
*/
-
- public void setRecalc(boolean recalc)
- {
- field_1_recalc = ( short ) ((recalc == true) ? 1
- : 0);
+ public void setRecalc(boolean recalc) {
+ field_1_recalc = ( short ) (recalc ? 1 : 0);
}
/**
* get whether to recalculate formulas/etc before saving or not
* @return recalc - whether to recalculate or not
*/
-
public boolean getRecalc()
{
return (field_1_recalc == 1);
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[SAVERECALC]\n");
- buffer.append(" .recalc = ").append(getRecalc())
- .append("\n");
- buffer.append("[/SAVERECALC]\n");
- return buffer.toString();
+ public String toString() {
+ return "[SAVERECALC]\n" +
+ " .recalc = " + getRecalc() +
+ "\n" +
+ "[/SAVERECALC]\n";
}
public void serialize(LittleEndianOutput out) {
diff --git a/src/java/org/apache/poi/hssf/util/HSSFColor.java b/src/java/org/apache/poi/hssf/util/HSSFColor.java
index 1490abf791..3c0ba6a9ce 100644
--- a/src/java/org/apache/poi/hssf/util/HSSFColor.java
+++ b/src/java/org/apache/poi/hssf/util/HSSFColor.java
@@ -168,7 +168,7 @@ public class HSSFColor implements Color {
*
* @return a Map containing all colours keyed by <tt>Integer</tt> excel-style palette indexes
*/
- public static final synchronized Map<Integer,HSSFColor> getIndexHash() {
+ public static synchronized Map<Integer,HSSFColor> getIndexHash() {
if(indexHash == null) {
indexHash = Collections.unmodifiableMap( createColorsByIndexMap() );
}
@@ -181,7 +181,7 @@ public class HSSFColor implements Color {
* the table, then call {@link #getIndexHash()} which returns a
* statically cached immutable map of colours.
*/
- public static final Map<Integer,HSSFColor> getMutableIndexHash() {
+ public static Map<Integer,HSSFColor> getMutableIndexHash() {
return createColorsByIndexMap();
}
diff --git a/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java b/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java
index f2cc9c2aa0..6a43a62047 100644
--- a/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java
+++ b/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java
@@ -86,7 +86,7 @@ public final class DStarRunner implements Function3Arg {
}
// Create an algorithm runner.
- IDStarAlgorithm algorithm = null;
+ IDStarAlgorithm algorithm;
switch(algoType) {
case DGET: algorithm = new DGet(); break;
case DMIN: algorithm = new DMin(); break;
@@ -97,7 +97,7 @@ public final class DStarRunner implements Function3Arg {
// Iterate over all DB entries.
final int height = db.getHeight();
for(int row = 1; row < height; ++row) {
- boolean matches = true;
+ boolean matches;
try {
matches = fullfillsConditions(db, row, cdb);
}
@@ -133,7 +133,7 @@ public final class DStarRunner implements Function3Arg {
* @param nameValueEval Must not be a RefEval or AreaEval. Thus make sure resolveReference() is called on the value first!
* @param db Database
* @return Corresponding column number.
- * @throws EvaluationException
+ * @throws EvaluationException If it's not possible to turn all headings into strings.
*/
private static int getColumnForName(ValueEval nameValueEval, AreaEval db)
throws EvaluationException {
@@ -193,7 +193,7 @@ public final class DStarRunner implements Function3Arg {
// Whether the condition column matches a database column, if not it's a
// special column that accepts formulas.
boolean columnCondition = true;
- ValueEval condition = null;
+ ValueEval condition;
// The condition to apply.
condition = resolveReference(cdb, conditionRow, column);
@@ -212,7 +212,7 @@ public final class DStarRunner implements Function3Arg {
// No column found, it's again a special column that accepts formulas.
columnCondition = false;
- if(columnCondition == true) { // normal column condition
+ if(columnCondition) { // normal column condition
// Should not throw, checked above.
ValueEval value = resolveReference(db, row, getColumnForName(targetHeader, db));
if(!testNormalCondition(value, condition)) {
@@ -228,7 +228,7 @@ public final class DStarRunner implements Function3Arg {
"D* function with formula conditions");
}
}
- if (matches == true) {
+ if (matches) {
return true;
}
}
@@ -256,8 +256,7 @@ public final class DStarRunner implements Function3Arg {
} else {
return testNumericCondition(value, operator.smallerThan, number);
}
- }
- else if(conditionString.startsWith(">")) { // It's a >/>= condition.
+ } else if(conditionString.startsWith(">")) { // It's a >/>= condition.
String number = conditionString.substring(1);
if(number.startsWith("=")) {
number = number.substring(1);
@@ -265,15 +264,14 @@ public final class DStarRunner implements Function3Arg {
} else {
return testNumericCondition(value, operator.largerThan, number);
}
- }
- else if(conditionString.startsWith("=")) { // It's a = condition.
+ } else if(conditionString.startsWith("=")) { // It's a = condition.
String stringOrNumber = conditionString.substring(1);
if(stringOrNumber.isEmpty()) {
return value instanceof BlankEval;
}
// Distinguish between string and number.
- boolean itsANumber = false;
+ boolean itsANumber;
try {
Integer.parseInt(stringOrNumber);
itsANumber = true;
@@ -300,25 +298,17 @@ public final class DStarRunner implements Function3Arg {
return valueString.startsWith(conditionString);
}
}
- }
- else if(condition instanceof NumericValueEval) {
- double conditionNumber = ((NumericValueEval)condition).getNumberValue();
+ } else if(condition instanceof NumericValueEval) {
+ double conditionNumber = ((NumericValueEval) condition).getNumberValue();
Double valueNumber = getNumberFromValueEval(value);
- if(valueNumber == null) {
- return false;
- }
-
- return conditionNumber == valueNumber;
- }
- else if(condition instanceof ErrorEval) {
+ return valueNumber != null && conditionNumber == valueNumber;
+ } else if(condition instanceof ErrorEval) {
if(value instanceof ErrorEval) {
return ((ErrorEval)condition).getErrorCode() == ((ErrorEval)value).getErrorCode();
- }
- else {
+ } else {
return false;
}
- }
- else {
+ } else {
return false;
}
}
@@ -340,7 +330,7 @@ public final class DStarRunner implements Function3Arg {
double value = ((NumericValueEval)valueEval).getNumberValue();
// Construct double from condition.
- double conditionValue = 0.0;
+ double conditionValue;
try {
conditionValue = Integer.parseInt(condition);
} catch (NumberFormatException e) { // It's not an int.
diff --git a/src/java/org/apache/poi/ss/formula/functions/ImReal.java b/src/java/org/apache/poi/ss/formula/functions/ImReal.java
index 0c7b81ada7..c5a6e15a51 100644
--- a/src/java/org/apache/poi/ss/formula/functions/ImReal.java
+++ b/src/java/org/apache/poi/ss/formula/functions/ImReal.java
@@ -60,7 +60,7 @@ public class ImReal extends Fixed1ArgFunction implements FreeRefFunction {
boolean result = m.matches();
String real = "";
- if (result == true) {
+ if (result) {
String realGroup = m.group(2);
boolean hasRealPart = realGroup.length() != 0;
diff --git a/src/java/org/apache/poi/ss/formula/functions/Imaginary.java b/src/java/org/apache/poi/ss/formula/functions/Imaginary.java
index 4c8b82423e..a030107207 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Imaginary.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Imaginary.java
@@ -71,7 +71,7 @@ public class Imaginary extends Fixed1ArgFunction implements FreeRefFunction {
boolean result = m.matches();
String imaginary = "";
- if (result == true) {
+ if (result) {
String imaginaryGroup = m.group(5);
boolean hasImaginaryPart = imaginaryGroup.equals("i") || imaginaryGroup.equals("j");
diff --git a/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java b/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java
index 4038774437..f079e15c41 100644
--- a/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java
+++ b/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java
@@ -34,7 +34,7 @@ import org.apache.commons.math3.linear.MatrixUtils;
*/
public abstract class MatrixFunction implements Function{
- public static final void checkValues(double[] results) throws EvaluationException {
+ public static void checkValues(double[] results) throws EvaluationException {
for (int idx = 0; idx < results.length; idx++) {
if (Double.isNaN(results[idx]) || Double.isInfinite(results[idx])) {
throw new EvaluationException(ErrorEval.NUM_ERROR);
diff --git a/src/java/org/apache/poi/ss/formula/functions/NumericFunction.java b/src/java/org/apache/poi/ss/formula/functions/NumericFunction.java
index 184ccdaa4e..1927848555 100644
--- a/src/java/org/apache/poi/ss/formula/functions/NumericFunction.java
+++ b/src/java/org/apache/poi/ss/formula/functions/NumericFunction.java
@@ -30,7 +30,7 @@ public abstract class NumericFunction implements Function {
static final double TEN = 10.0;
static final double LOG_10_TO_BASE_e = Math.log(TEN);
- protected static final double singleOperandEvaluate(ValueEval arg, int srcRowIndex, int srcColumnIndex) throws EvaluationException {
+ protected static double singleOperandEvaluate(ValueEval arg, int srcRowIndex, int srcColumnIndex) throws EvaluationException {
if (arg == null) {
throw new IllegalArgumentException("arg must not be null");
}
@@ -43,7 +43,7 @@ public abstract class NumericFunction implements Function {
/**
* @throws EvaluationException (#NUM!) if <tt>result</tt> is <tt>NaN</> or <tt>Infinity</tt>
*/
- public static final void checkValue(double result) throws EvaluationException {
+ public static void checkValue(double result) throws EvaluationException {
if (Double.isNaN(result) || Double.isInfinite(result)) {
throw new EvaluationException(ErrorEval.NUM_ERROR);
}
diff --git a/src/java/org/apache/poi/ss/formula/functions/Rate.java b/src/java/org/apache/poi/ss/formula/functions/Rate.java
index a9e8d5d78b..3b9de86dce 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Rate.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Rate.java
@@ -115,7 +115,7 @@ public class Rate implements Function {
*
* @throws EvaluationException (#NUM!) if <tt>result</tt> is <tt>NaN</> or <tt>Infinity</tt>
*/
- static final void checkValue(double result) throws EvaluationException {
+ static void checkValue(double result) throws EvaluationException {
if (Double.isNaN(result) || Double.isInfinite(result)) {
throw new EvaluationException(ErrorEval.NUM_ERROR);
}
diff --git a/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java b/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java
index 1823698cda..8888687157 100644
--- a/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java
+++ b/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java
@@ -123,7 +123,7 @@ public abstract class AbstractFunctionPtg extends OperationPtg {
* @return <code>true</code> if the name specifies a standard worksheet function,
* <code>false</code> if the name should be assumed to be an external function.
*/
- public static final boolean isBuiltInFunctionName(String name) {
+ public static boolean isBuiltInFunctionName(String name) {
short ix = FunctionMetadataRegistry.lookupIndexByName(name.toUpperCase(Locale.ROOT));
return ix >= 0;
}
diff --git a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
index 66e8c28344..7b557fd658 100644
--- a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
+++ b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
@@ -693,7 +693,7 @@ public class DataFormatter implements Observer {
private BigDecimal divider;
private static final BigDecimal ONE_THOUSAND = new BigDecimal(1000);
private final DecimalFormat df;
- private static final String trimTrailingCommas(String s) {
+ private static String trimTrailingCommas(String s) {
return s.replaceAll(",+$", "");
}
diff --git a/src/java/org/apache/poi/ss/usermodel/FormulaError.java b/src/java/org/apache/poi/ss/usermodel/FormulaError.java
index 2ce1e44fe2..996861e75a 100644
--- a/src/java/org/apache/poi/ss/usermodel/FormulaError.java
+++ b/src/java/org/apache/poi/ss/usermodel/FormulaError.java
@@ -158,7 +158,7 @@ public enum FormulaError {
}
}
- public static final boolean isValidCode(int errorCode) {
+ public static boolean isValidCode(int errorCode) {
for (FormulaError error : values()) {
if (error.getCode() == errorCode) return true;
if (error.getLongCode() == errorCode) return true;
diff --git a/src/java/org/apache/poi/ss/util/SheetBuilder.java b/src/java/org/apache/poi/ss/util/SheetBuilder.java
index 9dc0c6096f..32fdb134a3 100644
--- a/src/java/org/apache/poi/ss/util/SheetBuilder.java
+++ b/src/java/org/apache/poi/ss/util/SheetBuilder.java
@@ -98,8 +98,8 @@ public class SheetBuilder {
*/
public Sheet build() {
Sheet sheet = (sheetName == null) ? workbook.createSheet() : workbook.createSheet(sheetName);
- Row currentRow = null;
- Cell currentCell = null;
+ Row currentRow;
+ Cell currentCell;
for (int rowIndex = 0; rowIndex < cells.length; ++rowIndex) {
Object[] rowArray = cells[rowIndex];
@@ -125,7 +125,9 @@ public class SheetBuilder {
private void setCellValue(Cell cell, Object value) {
if (value == null || cell == null) {
return;
- } else if (value instanceof Number) {
+ }
+
+ if (value instanceof Number) {
double doubleValue = ((Number) value).doubleValue();
cell.setCellValue(doubleValue);
} else if (value instanceof Date) {
@@ -142,11 +144,7 @@ public class SheetBuilder {
private boolean isFormulaDefinition(Object obj) {
if (obj instanceof String) {
String str = (String) obj;
- if (str.length() < 2) {
- return false;
- } else {
- return ((String) obj).charAt(0) == '=';
- }
+ return str.length() >= 2 && str.charAt(0) == '=';
} else {
return false;
}
@@ -155,4 +153,4 @@ public class SheetBuilder {
private String getFormula(Object obj) {
return ((String) obj).substring(1);
}
-} \ No newline at end of file
+}
diff --git a/src/java/org/apache/poi/ss/util/WorkbookUtil.java b/src/java/org/apache/poi/ss/util/WorkbookUtil.java
index 012312a9c6..8475a0d53c 100644
--- a/src/java/org/apache/poi/ss/util/WorkbookUtil.java
+++ b/src/java/org/apache/poi/ss/util/WorkbookUtil.java
@@ -41,7 +41,7 @@ public class WorkbookUtil {
* allowed to be null
* @return a valid string, "empty" if to short, "null" if null
*/
- public final static String createSafeSheetName(final String nameProposal) {
+ public static String createSafeSheetName(final String nameProposal) {
return createSafeSheetName(nameProposal, ' ');
}
@@ -64,7 +64,7 @@ public class WorkbookUtil {
* @param replaceChar the char to replace invalid characters.
* @return a valid string, "empty" if to short, "null" if null
*/
- public final static String createSafeSheetName(final String nameProposal, char replaceChar) {
+ public static String createSafeSheetName(final String nameProposal, char replaceChar) {
if (nameProposal == null) {
return "null";
}
diff --git a/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java b/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java
index fa3d608c0a..fedd27acac 100644
--- a/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java
+++ b/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java
@@ -141,20 +141,14 @@ public class POIXMLTypeLoader {
}
public static XmlObject parse(File file, SchemaType type, XmlOptions options) throws XmlException, IOException {
- InputStream is = new FileInputStream(file);
- try {
+ try (InputStream is = new FileInputStream(file)) {
return parse(is, type, options);
- } finally {
- is.close();
}
}
public static XmlObject parse(URL file, SchemaType type, XmlOptions options) throws XmlException, IOException {
- InputStream is = file.openStream();
- try {
+ try (InputStream is = file.openStream()) {
return parse(is, type, options);
- } finally {
- is.close();
}
}
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java
index 8cd1c9f5de..09fb30f70b 100644
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java
@@ -22,7 +22,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.HashMap;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
diff --git a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/RevocationData.java b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/RevocationData.java
index ca89ba4c99..aa40675322 100644
--- a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/RevocationData.java
+++ b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/RevocationData.java
@@ -109,7 +109,7 @@ public class RevocationData {
* responses.
*/
public boolean hasOCSPs() {
- return false == this.ocsps.isEmpty();
+ return !this.ocsps.isEmpty();
}
/**
@@ -118,7 +118,7 @@ public class RevocationData {
* @return <code>true</code> if this revocation data set holds CRLs.
*/
public boolean hasCRLs() {
- return false == this.crls.isEmpty();
+ return !this.crls.isEmpty();
}
/**
diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFShape.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFShape.java
index f997c3b0fd..607c5bb150 100644
--- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFShape.java
+++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFShape.java
@@ -819,7 +819,7 @@ public class XDGFShape extends XDGFSheet {
*/
public Path2D.Double getPath() {
for (GeometrySection geoSection : getGeometrySections()) {
- if (geoSection.getNoShow() == true)
+ if (geoSection.getNoShow())
continue;
return geoSection.getPath(this);
@@ -833,7 +833,7 @@ public class XDGFShape extends XDGFSheet {
*/
public boolean hasGeometry() {
for (GeometrySection geoSection : getGeometrySections()) {
- if (geoSection.getNoShow() == false)
+ if (!geoSection.getNoShow())
return true;
}
return false;
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
index 8124ccff1c..ea53360084 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
@@ -96,7 +96,7 @@ public class XSLFTextRun implements TextRun {
String txt = ((CTRegularTextRun)_r).getT();
TextCap cap = getTextCap();
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for(int i = 0; i < txt.length(); i++) {
char c = txt.charAt(i);
if(c == '\t') {
@@ -123,10 +123,7 @@ public class XSLFTextRun implements TextRun {
public void setText(String text){
if (_r instanceof CTTextField) {
((CTTextField)_r).setT(text);
- } else if (_r instanceof CTTextLineBreak) {
- // ignored
- return;
- } else {
+ } else if (!(_r instanceof CTTextLineBreak)) {
((CTRegularTextRun)_r).setT(text);
}
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBuiltinTableStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBuiltinTableStyle.java
index 440aaf69b7..84a5e916b3 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBuiltinTableStyle.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBuiltinTableStyle.java
@@ -369,7 +369,7 @@ public enum XSSFBuiltinTableStyle {
* Public so clients can initialize the map on startup rather than lazily
* during evaluation if desired.
*/
- public static final synchronized void init() {
+ public static synchronized void init() {
if (! styleMap.isEmpty()) return;
/*
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
index a2e95c3ea7..20c6e92642 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
@@ -158,7 +158,6 @@ public final class XSSFGraphicFrame extends XSSFShape {
CTGraphicalObjectData data = graphicFrame.getGraphic().addNewGraphicData();
appendChartElement(data, relId);
chart.setGraphicFrame(this);
- return;
}
/**
diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
index 904fb3845d..7cea879cbc 100644
--- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
+++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
@@ -242,10 +242,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
// Get the hyperlinks
// TODO: make me optional/separated in private function
try {
- Iterator<PackageRelationship> relIter =
- getPackagePart().getRelationshipsByType(XWPFRelation.HYPERLINK.getRelation()).iterator();
- while (relIter.hasNext()) {
- PackageRelationship rel = relIter.next();
+ for (PackageRelationship rel : getPackagePart().getRelationshipsByType(XWPFRelation.HYPERLINK.getRelation())) {
hyperlinks.add(new XWPFHyperlink(rel.getId(), rel.getTargetURI().toString()));
}
} catch (InvalidFormatException e) {
@@ -453,7 +450,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
// TODO this needs to be migrated out into section code
if (type == HeaderFooterType.FIRST) {
CTSectPr ctSectPr = getSection();
- if (ctSectPr.isSetTitlePg() == false) {
+ if (!ctSectPr.isSetTitlePg()) {
CTOnOff titlePg = ctSectPr.addNewTitlePg();
titlePg.setVal(STOnOff.ON);
}
@@ -475,7 +472,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
// TODO this needs to be migrated out into section code
if (type == HeaderFooterType.FIRST) {
CTSectPr ctSectPr = getSection();
- if (ctSectPr.isSetTitlePg() == false) {
+ if (!ctSectPr.isSetTitlePg()) {
CTOnOff titlePg = ctSectPr.addNewTitlePg();
titlePg.setVal(STOnOff.ON);
}
@@ -600,7 +597,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
* parameter points to the {@link org.apache.xmlbeans.XmlCursor.TokenType#END}
* of the newly inserted paragraph.
*
- * @param cursor
+ * @param cursor The cursor-position where the new paragraph should be added.
* @return the {@link XWPFParagraph} object representing the newly inserted
* CTP object
*/
diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSDTContent.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSDTContent.java
index 185e453aa0..587674edc3 100644
--- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSDTContent.java
+++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSDTContent.java
@@ -98,7 +98,7 @@ public class XWPFSDTContent implements ISDTContent {
text.append(o);
addNewLine = false;
}
- if (addNewLine == true && i < bodyElements.size() - 1) {
+ if (addNewLine && i < bodyElements.size() - 1) {
text.append("\n");
}
}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java b/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java
index 652d40fbcb..8cbdfe270d 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java
@@ -207,10 +207,10 @@ public final class TestStylesTable {
}
}
- private static final <K,V> void assertNotContainsKey(Map<K,V> map, K key) {
+ private static <K,V> void assertNotContainsKey(Map<K,V> map, K key) {
assertFalse(map.containsKey(key));
}
- private static final <K,V> void assertNotContainsValue(Map<K,V> map, V value) {
+ private static <K,V> void assertNotContainsValue(Map<K,V> map, V value) {
assertFalse(map.containsValue(value));
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java b/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
index d4bf8ab337..a714f1950b 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
@@ -86,8 +86,9 @@ public abstract class RecordContainer extends Record
/**
* Adds the given new Child Record at the given location,
* shuffling everything from there on down by one
- * @param newChild
- * @param position
+ *
+ * @param newChild The record to be added as child-record.
+ * @param position The index where the child should be added, 0-based
*/
private void addChildAt(Record newChild, int position) {
// Firstly, have the child added in at the end
@@ -168,8 +169,8 @@ public abstract class RecordContainer extends Record
/**
* Adds the given Child Record after the supplied record
- * @param newChild
- * @param after
+ * @param newChild The record to add as new child.
+ * @param after The record after which the given record should be added.
* @return the position of the added child within the list
*/
public int addChildAfter(Record newChild, Record after) {
@@ -186,8 +187,8 @@ public abstract class RecordContainer extends Record
/**
* Adds the given Child Record before the supplied record
- * @param newChild
- * @param before
+ * @param newChild The record to add as new child.
+ * @param before The record before which the given record should be added.
* @return the position of the added child within the list
*/
public int addChildBefore(Record newChild, Record before) {
@@ -309,8 +310,8 @@ public abstract class RecordContainer extends Record
mout.write(new byte[4]);
// Write out the children
- for(int i=0; i<children.length; i++) {
- children[i].writeOut(mout);
+ for (Record aChildren : children) {
+ aChildren.writeOut(mout);
}
// Update our header with the size
@@ -335,8 +336,8 @@ public abstract class RecordContainer extends Record
baos.write(new byte[] {0,0,0,0});
// Write out our children
- for(int i=0; i<children.length; i++) {
- children[i].writeOut(baos);
+ for (Record aChildren : children) {
+ aChildren.writeOut(baos);
}
// Grab the bytes back
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
index 1dde0d03d4..5eb222b900 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
@@ -169,7 +169,7 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
/**
* Constructs a new, empty, Powerpoint document.
*/
- public static final HSLFSlideShowImpl create() {
+ public static HSLFSlideShowImpl create() {
InputStream is = HSLFSlideShowImpl.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt");
if (is == null) {
throw new HSLFException("Missing resource 'empty.ppt'");
diff --git a/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java b/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java
index 1f4505613d..ce10b6dab8 100644
--- a/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java
+++ b/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java
@@ -100,7 +100,7 @@ public class MAPIMessage extends POIReadOnlyDocument {
* Constructor for reading MSG Files from the file system.
*
* @param filename Name of the file to read
- * @throws IOException
+ * @exception IOException on errors reading, or invalid data
*/
public MAPIMessage(String filename) throws IOException {
this(new File(filename));
@@ -109,7 +109,7 @@ public class MAPIMessage extends POIReadOnlyDocument {
* Constructor for reading MSG Files from the file system.
*
* @param file The file to read from
- * @throws IOException
+ * @exception IOException on errors reading, or invalid data
*/
public MAPIMessage(File file) throws IOException {
this(new NPOIFSFileSystem(file));
@@ -122,7 +122,7 @@ public class MAPIMessage extends POIReadOnlyDocument {
* in order to process. For lower memory use, use {@link #MAPIMessage(File)}
*
* @param in The InputStream to buffer then read from
- * @throws IOException
+ * @exception IOException on errors reading, or invalid data
*/
public MAPIMessage(InputStream in) throws IOException {
this(new NPOIFSFileSystem(in));
@@ -131,7 +131,7 @@ public class MAPIMessage extends POIReadOnlyDocument {
* Constructor for reading MSG Files from a POIFS filesystem
*
* @param fs Open POIFS FileSystem containing the message
- * @throws IOException
+ * @exception IOException on errors reading, or invalid data
*/
public MAPIMessage(NPOIFSFileSystem fs) throws IOException {
this(fs.getRoot());
@@ -140,7 +140,7 @@ public class MAPIMessage extends POIReadOnlyDocument {
* Constructor for reading MSG Files from a certain
* point within a POIFS filesystem
* @param poifsDir Directory containing the message
- * @throws IOException
+ * @exception IOException on errors reading, or invalid data
*/
public MAPIMessage(DirectoryNode poifsDir) throws IOException {
super(poifsDir);
@@ -195,7 +195,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
/**
* Gets the plain text body of this Outlook Message
* @return The string representation of the 'text' version of the body, if available.
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the text-body chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getTextBody() throws ChunkNotFoundException {
return getStringFromChunk(mainChunks.getTextBodyChunk());
@@ -205,7 +206,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
* Gets the html body of this Outlook Message, if this email
* contains a html version.
* @return The string representation of the 'html' version of the body, if available.
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the html-body chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getHtmlBody() throws ChunkNotFoundException {
if(mainChunks.getHtmlBodyChunkBinary() != null) {
@@ -218,7 +220,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
* Gets the RTF Rich Message body of this Outlook Message, if this email
* contains a RTF (rich) version.
* @return The string representation of the 'RTF' version of the body, if available.
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the rtf-body chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getRtfBody() throws ChunkNotFoundException {
ByteChunk chunk = mainChunks.getRtfBodyChunk();
@@ -242,7 +245,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
/**
* Gets the subject line of the Outlook Message
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the subject-chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getSubject() throws ChunkNotFoundException {
return getStringFromChunk(mainChunks.getSubjectChunk());
@@ -251,7 +255,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
/**
* Gets the display value of the "FROM" line of the outlook message
* This is not the actual address that was sent from but the formated display of the user name.
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the from-chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getDisplayFrom() throws ChunkNotFoundException {
return getStringFromChunk(mainChunks.getDisplayFromChunk());
@@ -264,7 +269,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
* This is not the actual list of addresses/values that will be
* sent to if you click Reply in the email - those are stored
* in {@link RecipientChunks}.
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the to-chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getDisplayTo() throws ChunkNotFoundException {
return getStringFromChunk(mainChunks.getDisplayToChunk());
@@ -277,7 +283,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
* This is not the actual list of addresses/values that will be
* sent to if you click Reply in the email - those are stored
* in {@link RecipientChunks}.
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the cc-chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getDisplayCC() throws ChunkNotFoundException {
return getStringFromChunk(mainChunks.getDisplayCCChunk());
@@ -291,7 +298,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
* sent to if you click Reply in the email - those are stored
* in {@link RecipientChunks}.
* This will only be present in sent emails, not received ones!
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the bcc-chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getDisplayBCC() throws ChunkNotFoundException {
return getStringFromChunk(mainChunks.getDisplayBCCChunk());
@@ -440,7 +448,6 @@ public class MAPIMessage extends POIReadOnlyDocument {
// Found it! Tell all the string chunks
String charset = m.group(1);
set7BitEncoding(charset);
- return;
}
}
} catch(ChunkNotFoundException e) {}
@@ -529,7 +536,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
/**
* Gets the conversation topic of the parsed Outlook Message.
* This is the part of the subject line that is after the RE: and FWD:
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the conversation-topic chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public String getConversationTopic() throws ChunkNotFoundException {
return getStringFromChunk(mainChunks.getConversationTopic());
@@ -541,7 +549,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
* item, note, or actual outlook Message)
* For emails the class will be IPM.Note
*
- * @throws ChunkNotFoundException
+ * @throws ChunkNotFoundException If the message-class chunk does not exist and
+ * returnNullOnMissingChunk is set
*/
public MESSAGE_CLASS getMessageClassEnum() throws ChunkNotFoundException {
String mc = getStringFromChunk(mainChunks.getMessageClass());
@@ -643,7 +652,7 @@ public class MAPIMessage extends POIReadOnlyDocument {
private String toSemicolonList(String[] l) {
- StringBuffer list = new StringBuffer();
+ StringBuilder list = new StringBuilder();
boolean first = true;
for(String s : l) {
diff --git a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java
index b3f3cf5c5c..dacf09ed27 100644
--- a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java
+++ b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java
@@ -207,9 +207,9 @@ public final class Chunks implements ChunkGroupWithProperties {
conversationTopic = (StringChunk) chunk;
} else if (prop == MAPIProperty.SUBJECT) {
subjectChunk = (StringChunk) chunk;
- } else if (prop == MAPIProperty.ORIGINAL_SUBJECT) {
+ } /*else if (prop == MAPIProperty.ORIGINAL_SUBJECT) {
// TODO
- }
+ }*/
else if (prop == MAPIProperty.DISPLAY_TO) {
displayToChunk = (StringChunk) chunk;
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
index b5ec864ff1..d43266b40e 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
@@ -691,8 +691,6 @@ public abstract class AbstractWordConverter
if ( separatorMark + 1 < endMark )
processCharacters( wordDocument, currentTableLevel,
deadFieldValueSubrage, currentBlock );
-
- return;
}
public void processDocument( HWPFDocumentCore wordDocument )
@@ -1106,7 +1104,7 @@ public abstract class AbstractWordConverter
}
}
- if ( processed == false )
+ if (!processed)
{
processParagraph( wordDocument, flow, currentTableLevel,
paragraph, AbstractWordUtils.EMPTY );
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java
index 7ce31b13a5..e050cfa59a 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java
@@ -462,7 +462,6 @@ public class WordToFoConverter extends AbstractWordConverter
}
WordToFoUtils.compactInlines( block );
- return;
}
protected void processSection( HWPFDocumentCore wordDocument,
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
index 3ea2c596a0..38c45361b0 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
@@ -202,11 +202,11 @@ public class WordToHtmlConverter extends AbstractWordConverter
&& !AbstractWordUtils.equals( triplet.fontName,
blockProperies.pFontName ) )
{
- style.append( "font-family:" + triplet.fontName + ";" );
+ style.append("font-family:").append(triplet.fontName).append(";");
}
if ( characterRun.getFontSize() / 2 != blockProperies.pFontSize )
{
- style.append( "font-size:" + characterRun.getFontSize() / 2 + "pt;" );
+ style.append("font-size:").append(characterRun.getFontSize() / 2).append("pt;");
}
if ( triplet.bold )
{
@@ -593,7 +593,6 @@ public class WordToHtmlConverter extends AbstractWordConverter
}
WordToHtmlUtils.compactSpans( pElement );
- return;
}
@Override
diff --git a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
index e57118b835..bf66cecef4 100644
--- a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
+++ b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
@@ -42,7 +42,7 @@ import org.junit.After;
* Testing for {@link HSSFEventFactory}
*/
public final class TestHSSFEventFactory extends TestCase {
- private static final InputStream openSample(String sampleFileName) {
+ private static InputStream openSample(String sampleFileName) {
return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java
index 2f6a14b769..e0d14b8da9 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java
@@ -184,7 +184,7 @@ public final class TestFormulaRecord extends TestCase {
fr0.setCachedResultBoolean(false);
fr1.setCachedResultBoolean(true);
- if (fr0.getCachedBooleanValue() == true && fr1.getCachedBooleanValue() == false) {
+ if (fr0.getCachedBooleanValue() && !fr1.getCachedBooleanValue()) {
throw new AssertionFailedError("Identified bug 46479c");
}
assertEquals(false, fr0.getCachedBooleanValue());
diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java b/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java
index cb156728eb..cb61e98ed8 100644
--- a/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java
+++ b/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java
@@ -34,10 +34,10 @@ import org.apache.poi.hssf.OldExcelFormatException;
* checks
*/
public class TestNotOLE2Exception extends TestCase {
- private static final InputStream openXLSSampleStream(String sampleFileName) {
+ private static InputStream openXLSSampleStream(String sampleFileName) {
return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
}
- private static final InputStream openDOCSampleStream(String sampleFileName) {
+ private static InputStream openDOCSampleStream(String sampleFileName) {
return POIDataSamples.getDocumentInstance().openResourceAsStream(sampleFileName);
}
diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java b/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java
index e78e19f375..8b53738030 100644
--- a/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java
+++ b/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java
@@ -34,7 +34,7 @@ import junit.framework.TestCase;
*/
public class TestOfficeXMLException extends TestCase {
- private static final InputStream openSampleStream(String sampleFileName) {
+ private static InputStream openSampleStream(String sampleFileName) {
return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
}
public void testOOXMLException() throws IOException
diff --git a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java b/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java
index 804fcb20fc..3b9a53ff48 100644
--- a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java
+++ b/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java
@@ -108,15 +108,11 @@ public class TestForkedEvaluator {
public void testMissingInputCellH() throws IOException {
expectedEx.expect(UnsupportedOperationException.class);
expectedEx.expectMessage("Underlying cell 'A2' is missing in master sheet.");
-
- Workbook wb = createWorkbook();
- try {
- ForkedEvaluator fe = ForkedEvaluator.create(wb, null, null);
- // attempt update input at cell A2 (which is missing)
- fe.updateCell("Inputs", 1, 0, new NumberEval(4.0));
- } finally {
- wb.close();
+ try (Workbook wb = createWorkbook()) {
+ ForkedEvaluator fe = ForkedEvaluator.create(wb, null, null);
+ // attempt update input at cell A2 (which is missing)
+ fe.updateCell("Inputs", 1, 0, new NumberEval(4.0));
}
}
}
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java b/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java
index 202a9e06c7..1e4abfae08 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java
@@ -36,14 +36,14 @@ public abstract class AbstractPtgTestCase extends TestCase {
* @param sampleFileName the filename.
* @return the loaded workbook.
*/
- protected static final HSSFWorkbook loadWorkbook(String sampleFileName) {
+ protected static HSSFWorkbook loadWorkbook(String sampleFileName) {
return HSSFTestDataSamples.openSampleWorkbook(sampleFileName);
}
/**
* Creates a new Workbook and adds one sheet with the specified name
*/
- protected static final HSSFWorkbook createWorkbookWithSheet(String sheetName) {
+ protected static HSSFWorkbook createWorkbookWithSheet(String sheetName) {
HSSFWorkbook book = new HSSFWorkbook();
book.createSheet(sheetName);
return book;