Various code cleanups, "final" for static methods is useless, for-loops, simplify boolean conditions, try-with-resource, javadoc, ...
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
75c63b6bbe
commit
b644047b70
@ -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]);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)));
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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(",+$", "");
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
/*
|
||||
|
@ -158,7 +158,6 @@ public final class XSSFGraphicFrame extends XSSFShape {
|
||||
CTGraphicalObjectData data = graphicFrame.getGraphic().addNewGraphicData();
|
||||
appendChartElement(data, relId);
|
||||
chart.setGraphicFrame(this);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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'");
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -462,7 +462,6 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||
}
|
||||
|
||||
WordToFoUtils.compactInlines( block );
|
||||
return;
|
||||
}
|
||||
|
||||
protected void processSection( HWPFDocumentCore wordDocument,
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user