git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1882828 13f79535-47bb-0310-9956-ffa450edef68tags/before_ooxml_3rd_edition
@@ -18,7 +18,6 @@ | |||
package org.apache.poi.examples.hssf.eventusermodel; | |||
import java.io.FileInputStream; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
import java.io.PrintStream; | |||
import java.util.ArrayList; | |||
@@ -55,15 +54,15 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
*/ | |||
@SuppressWarnings({"java:S106","java:S4823"}) | |||
public class XLS2CSVmra implements HSSFListener { | |||
private int minColumns; | |||
private POIFSFileSystem fs; | |||
private PrintStream output; | |||
private final int minColumns; | |||
private final POIFSFileSystem fs; | |||
private final PrintStream output; | |||
private int lastRowNumber; | |||
private int lastColumnNumber; | |||
/** Should we output the formula, or the value it has? */ | |||
private boolean outputFormulaValues = true; | |||
private final boolean outputFormulaValues = true; | |||
/** For parsing Formulas */ | |||
private SheetRecordCollectingListener workbookBuildingListener; | |||
@@ -76,7 +75,7 @@ public class XLS2CSVmra implements HSSFListener { | |||
/** So we known which sheet we're on */ | |||
private int sheetIndex = -1; | |||
private BoundSheetRecord[] orderedBSRs; | |||
private List<BoundSheetRecord> boundSheetRecords = new ArrayList<>(); | |||
private final List<BoundSheetRecord> boundSheetRecords = new ArrayList<>(); | |||
// For handling formulas with string results | |||
private int nextRow; | |||
@@ -100,7 +99,7 @@ public class XLS2CSVmra implements HSSFListener { | |||
* @param filename The file to process | |||
* @param minColumns The minimum number of columns to output, or -1 for no minimum | |||
*/ | |||
public XLS2CSVmra(String filename, int minColumns) throws IOException, FileNotFoundException { | |||
public XLS2CSVmra(String filename, int minColumns) throws IOException { | |||
this( | |||
new POIFSFileSystem(new FileInputStream(filename)), | |||
System.out, minColumns |
@@ -142,7 +142,7 @@ public final class InternalWorkbook { | |||
/** whether 1904 date windowing is being used */ | |||
private boolean uses1904datewindowing; | |||
private DrawingManager2 drawingManager; | |||
private List<EscherBSERecord> escherBSERecords; | |||
private final List<EscherBSERecord> escherBSERecords; | |||
private WindowOneRecord windowOne; | |||
private FileSharingRecord fileShare; | |||
private WriteAccessRecord writeAccess; | |||
@@ -248,7 +248,7 @@ public final class InternalWorkbook { | |||
logObj = "format"; | |||
FormatRecord fr = (FormatRecord) rec; | |||
retval.formats.add(fr); | |||
retval.maxformatid = retval.maxformatid >= fr.getIndexCode() ? retval.maxformatid : fr.getIndexCode(); | |||
retval.maxformatid = Math.max(retval.maxformatid, fr.getIndexCode()); | |||
break; | |||
case DateWindow1904Record.sid : | |||
@@ -367,7 +367,7 @@ public final class InternalWorkbook { | |||
// set up format records | |||
for (int i = 0; i <= 7; i++) { | |||
FormatRecord rec = createFormat(i); | |||
retval.maxformatid = retval.maxformatid >= rec.getIndexCode() ? retval.maxformatid : rec.getIndexCode(); | |||
retval.maxformatid = Math.max(retval.maxformatid, rec.getIndexCode()); | |||
formats.add(rec); | |||
records.add(rec); | |||
} | |||
@@ -1036,7 +1036,7 @@ public final class InternalWorkbook { | |||
} | |||
pos += len; | |||
} | |||
LOG.log( DEBUG, "Exiting serialize workbook" ); | |||
return pos; | |||
} | |||
@@ -1850,7 +1850,7 @@ public final class InternalWorkbook { | |||
drawingManager = findDrawingManager(dg, escherBSERecords); | |||
return drawingManager; | |||
} | |||
private static DrawingManager2 findDrawingManager(DrawingGroupRecord dg, List<EscherBSERecord> escherBSERecords) { | |||
if (dg == null) { | |||
return null; | |||
@@ -1874,7 +1874,7 @@ public final class InternalWorkbook { | |||
if(dgg == null) { | |||
return null; | |||
} | |||
DrawingManager2 dm = new DrawingManager2(dgg); | |||
if(bStore != null){ | |||
for(EscherRecord bs : bStore.getChildRecords()){ | |||
@@ -2110,7 +2110,7 @@ public final class InternalWorkbook { | |||
if(aggLoc == -1) { | |||
return; | |||
} | |||
EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid); | |||
EscherContainerRecord escherContainer = agg.getEscherContainer(); | |||
if (escherContainer == null) { |
@@ -29,10 +29,9 @@ import java.io.IOException; | |||
import org.apache.poi.hssf.record.CountryRecord; | |||
import org.apache.poi.hssf.record.FontRecord; | |||
import org.apache.poi.hssf.record.RecalcIdRecord; | |||
import org.apache.poi.hssf.record.WriteAccessRecord; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.hssf.usermodel.TestHSSFWorkbook; | |||
import org.apache.poi.ss.formula.OperationEvaluationContext; | |||
import org.apache.poi.ss.formula.eval.ValueEval; | |||
import org.apache.poi.ss.formula.functions.FreeRefFunction; | |||
import org.apache.poi.ss.formula.udf.AggregatingUDFFinder; | |||
import org.apache.poi.ss.formula.udf.DefaultUDFFinder; | |||
@@ -108,11 +107,8 @@ public final class TestWorkbook { | |||
InternalWorkbook wb = TestHSSFWorkbook.getInternalWorkbook(hwb); | |||
assertNotNull(wb.getNameXPtg("ISODD", AggregatingUDFFinder.DEFAULT)); | |||
FreeRefFunction NotImplemented = new FreeRefFunction() { | |||
@Override | |||
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { | |||
throw new RuntimeException("not implemented"); | |||
} | |||
FreeRefFunction NotImplemented = (args, ec) -> { | |||
throw new RuntimeException("not implemented"); | |||
}; | |||
/* | |||
@@ -155,7 +151,7 @@ public final class TestWorkbook { | |||
wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero | |||
assertEquals(0, record.getEngineId()); | |||
assertFalse(wb.getForceFormulaRecalculation()); | |||
wb.close(); | |||
} | |||
} |