Skip to content

Commit

Permalink
Merge pull request #643 from SteveSchafer-Innovent/issue-642
Browse files Browse the repository at this point in the history
POI Vulnerabilities #642
  • Loading branch information
wimjongman committed Apr 23, 2021
2 parents 0018a09 + 3b921b7 commit e309dbc
Show file tree
Hide file tree
Showing 27 changed files with 1,287 additions and 1,144 deletions.
3 changes: 0 additions & 3 deletions build/org.eclipse.birt.build/externalRepo.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ com.lowagie.text_2.1.7.v201004222200.jar, org.eclipse.birt.runtime.3_7_1, com.lo
derby.jar, org.eclipse.birt.runtime.3_7_1, derby, 10.5.1000001
js.jar, org.eclipse.birt.runtime.3_7_1, org.mozilla.javascript, 1.7.2
javax.wsdl_1.5.1.v201012040544.jar, org.eclipse.birt.runtime.3_7_1, javax.wsdl, 1.5.1
poi-3.9.jar, org.apache.poi, poi, 3.9
poi-ooxml-3.9.jar, org.apache.poi, poi-ooxml, 3.9
poi-ooxml-schemas-3.9.jar, org.apache.poi, poi-ooxml-schemas, 3.9
#dom4j-1.6.1.jar, dom4j, dom4j, 1.6.1
#xmlbeans-2.3.0.jar, org.apache.xmlbeans, xmlbeans, 2.3.0
#commons-codec-1.3.jar, commons-codec, commons-codec, 1.3
Expand Down
13 changes: 9 additions & 4 deletions build/org.eclipse.birt.target/org.eclipse.birt.target.target
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,18 @@
<unit id="org.apache.commons.codec" version="0.0.0"/>
<unit id="org.apache.derby" version="0.0.0"/>
<unit id="org.apache.lucene.analysis" version="0.0.0"/>
<unit id="org.apache.poi" version="0.0.0"/>
<unit id="org.apache.poi.ooxml" version="0.0.0"/>
<unit id="org.apache.poi.ooxml.schemas" version="0.0.0"/>
<unit id="org.apache.xmlbeans" version="0.0.0"/>
<unit id="org.eclipse.orbit.mongodb" version="0.0.0"/>
<unit id="org.dom4j" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/I20210306035740/repository/"/>
<unit id="org.apache.poi" version="4.1.1.v20200604-1524"/>
<unit id="org.apache.poi.ooxml" version="4.1.1.v20200820-1148"/>
<unit id="org.apache.poi.ooxml.schemas" version="4.1.1.v20200922-2105"/>
<unit id="org.apache.commons.collections4" version="4.4.0.v20200420-1700"/>
<unit id="org.apache.commons.compress" version="1.19.0.v20200106-2343"/>
<unit id="org.apache.xmlbeans" version="3.1.0.v20200922-1359"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/webtools/downloads/drops/R3.13.0/R-3.13.0-20190308131645/repository/"/>
<unit id="org.eclipse.jst.enterprise_ui.feature.feature.group" version="0.0.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.apache.xml.serializer;bundle-version="[2.7.1,3.0.0)",
org.apache.commons.logging;bundle-version="[1.0.4,2.0.0)";resolution:=optional,
javax.xml.stream;bundle-version="[1.0.1,2.0.0)";resolution:=optional,
org.apache.poi;bundle-version="[3.9.0,4.0.0)",
org.apache.poi.ooxml;bundle-version="[3.9.0,4.0.0)",
org.apache.poi.ooxml.schemas;bundle-version="[3.9.0,4.0.0)",
org.apache.poi;bundle-version="[4.1.1,5.0.0)",
org.apache.poi.ooxml;bundle-version="[4.1.1,5.0.0)",
org.apache.poi.ooxml.schemas;bundle-version="[4.1.1,5.0.0)",
org.apache.xerces;bundle-version="2.9.0",
org.eclipse.birt.core;bundle-version="4.9.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.eclipse.birt.report.data.oda.excel.ExcelODAConstants;
Expand Down Expand Up @@ -167,7 +169,7 @@ private void initialise() throws IOException, OdaException {
workBook = new HSSFWorkbook(fis);
}
formulaEvaluator = workBook.getCreationHelper().createFormulaEvaluator();
workBook.setMissingCellPolicy(Row.RETURN_NULL_AND_BLANK);
workBook.setMissingCellPolicy(MissingCellPolicy.RETURN_NULL_AND_BLANK /* Row.RETURN_NULL_AND_BLANK */);
sheet = workBook.getSheet(workSheetList.get(currentSheetIndex));
if (sheet == null)
throw new OdaException(Messages.getString("invalid_sheet_name"));
Expand Down Expand Up @@ -262,11 +264,11 @@ public String getCellValue(Cell cell) {
if (cell == null)
return ExcelODAConstants.EMPTY_STRING;

if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
if (cell.getCellType() == CellType.FORMULA /* Cell.CELL_TYPE_FORMULA */) {
return resolveFormula(cell);
}

if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
if (cell.getCellType() == CellType.NUMERIC /* Cell.CELL_TYPE_NUMERIC */) {
if (HSSFDateUtil.isCellDateFormatted(cell)) {
Date myjavadate = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
return sdf.format(myjavadate);
Expand All @@ -281,10 +283,10 @@ private String resolveFormula(Cell cell) {
if (formulaEvaluator == null)
return cell.toString();
switch (formulaEvaluator.evaluateFormulaCell(cell)) {
case Cell.CELL_TYPE_BOOLEAN:
case BOOLEAN /* Cell.CELL_TYPE_BOOLEAN */:
return ((Boolean) cell.getBooleanCellValue()).toString();

case Cell.CELL_TYPE_NUMERIC:
case NUMERIC /* Cell.CELL_TYPE_NUMERIC */:
if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell)) {
// need to check for nulls
// double myexdate =
Expand All @@ -294,7 +296,7 @@ private String resolveFormula(Cell cell) {
}
return ((Double) cell.getNumericCellValue()).toString();

case Cell.CELL_TYPE_STRING:
case STRING /* Cell.CELL_TYPE_STRING */:
return cell.getStringCellValue();

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Bundle-Version: 4.9.0.qualifier
Require-Bundle: org.eclipse.birt.report.engine;bundle-version="4.2.3",
org.eclipse.birt.report.engine.emitter.pptx;bundle-version="4.5.0",
org.junit,
org.apache.poi;bundle-version="[3.9.0,4.0.0)",
org.apache.poi.ooxml;bundle-version="[3.9.0,4.0.0)"
org.apache.poi;bundle-version="[4.1.1,5.0.0)",
org.apache.poi.ooxml;bundle-version="[4.1.1,5.0.0)"
Bundle-ClassPath: .
Automatic-Module-Name: org.eclipse.birt.report.engine.emitter.pptx.tests
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Require-Bundle: org.eclipse.core.runtime,
org.junit,
org.eclipse.birt.report.engine,
com.ibm.icu;bundle-version="4.4.2",
org.apache.poi;bundle-version="[3.9.0,4.0.0)",
org.apache.poi.ooxml;bundle-version="[3.9.0,4.0.0)",
org.apache.poi.ooxml.schemas;bundle-version="[3.9.0,4.0.0)"
org.apache.poi;bundle-version="[4.1.1,5.0.0)",
org.apache.poi.ooxml;bundle-version="[4.1.1,5.0.0)",
org.apache.poi.ooxml.schemas;bundle-version="[4.1.1,5.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/commons-codec-1.5.jar
Import-Package: uk.co.spudsoft.birt.emitters.excel
Import-Package: uk.co.spudsoft.birt.emitters.excel, org.apache.xmlbeans
Eclipse-BundleShape: dir
Automatic-Module-Name: uk.co.spudsoft.birt.emitters.excel.tests
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.InputStream;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Sheet;
Expand All @@ -30,8 +31,8 @@

public class Borders1ReportTest extends ReportRunner {

private void assertSingleBorder(Sheet sheet, int row, String border, short expected, short actual) {
if ((expected == CellStyle.BORDER_DOTTED) && (actual == CellStyle.BORDER_HAIR)
private void assertSingleBorder(Sheet sheet, int row, String border, BorderStyle expected, BorderStyle actual) {
if (BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */.equals(expected) && BorderStyle.HAIR /* CellStyle.BORDER_HAIR */.equals(actual)
&& (sheet instanceof XSSFSheet)) {
// Hopefully a temporary fudge to work around what is believe to be a bug in POI
return;
Expand All @@ -42,7 +43,7 @@ private void assertSingleBorder(Sheet sheet, int row, String border, short expec
assertEquals("Row " + row + ", border \"" + border + "\": ", expected, actual);
}

private void assertBorder(Sheet sheet, int row, int col, short bottom, short left, short right, short top) {
private void assertBorder(Sheet sheet, int row, int col, BorderStyle bottom, BorderStyle left, BorderStyle right, BorderStyle top) {

Cell cell = sheet.getRow(row).getCell(col);
CellStyle style = cell.getCellStyle();
Expand Down Expand Up @@ -70,33 +71,33 @@ public void testRunReport() throws BirtException, IOException {
assertEquals(12, firstNullRow(sheet));

int i = 0;
assertBorder(sheet, i++, 0, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN,
CellStyle.BORDER_THIN);
assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM,
CellStyle.BORDER_MEDIUM);
assertBorder(sheet, i++, 0, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK,
CellStyle.BORDER_THICK);

assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED,
CellStyle.BORDER_DOTTED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED,
CellStyle.BORDER_DOTTED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED,
CellStyle.BORDER_DOTTED);

assertBorder(sheet, i++, 0, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED,
CellStyle.BORDER_DASHED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED,
CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED,
CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED);

assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE,
CellStyle.BORDER_DOUBLE);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE,
CellStyle.BORDER_DOUBLE);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE,
CellStyle.BORDER_DOUBLE);
assertBorder(sheet, i++, 0, BorderStyle.THIN /* CellStyle.BORDER_THIN */, BorderStyle.THIN /* CellStyle.BORDER_THIN */, BorderStyle.THIN /* CellStyle.BORDER_THIN */,
BorderStyle.THIN /* CellStyle.BORDER_THIN */);
assertBorder(sheet, i++, 0, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */,
BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */);
assertBorder(sheet, i++, 0, BorderStyle.THICK /* CellStyle.BORDER_THICK */, BorderStyle.THICK /* CellStyle.BORDER_THICK */, BorderStyle.THICK /* CellStyle.BORDER_THICK */,
BorderStyle.THICK /* CellStyle.BORDER_THICK */);

assertBorder(sheet, i++, 0, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */,
BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */);
assertBorder(sheet, i++, 0, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */,
BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */);
assertBorder(sheet, i++, 0, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */,
BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */);

assertBorder(sheet, i++, 0, BorderStyle.DASHED /* CellStyle.BORDER_DASHED */, BorderStyle.DASHED /* CellStyle.BORDER_DASHED */, BorderStyle.DASHED /* CellStyle.BORDER_DASHED */,
BorderStyle.DASHED /* CellStyle.BORDER_DASHED */);
assertBorder(sheet, i++, 0, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */,
BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */);
assertBorder(sheet, i++, 0, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */,
BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */);

assertBorder(sheet, i++, 0, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */,
BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */);
assertBorder(sheet, i++, 0, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */,
BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */);
assertBorder(sheet, i++, 0, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */,
BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */);

} finally {
inputStream.close();
Expand All @@ -120,33 +121,33 @@ public void testRunReportXls() throws BirtException, IOException {
assertEquals(12, firstNullRow(sheet));

int i = 0;
assertBorder(sheet, i++, 0, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN,
CellStyle.BORDER_THIN);
assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM,
CellStyle.BORDER_MEDIUM);
assertBorder(sheet, i++, 0, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK,
CellStyle.BORDER_THICK);

assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED,
CellStyle.BORDER_DOTTED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED,
CellStyle.BORDER_DOTTED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED,
CellStyle.BORDER_DOTTED);

assertBorder(sheet, i++, 0, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED,
CellStyle.BORDER_DASHED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED,
CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED);
assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED,
CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED);

assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE,
CellStyle.BORDER_DOUBLE);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE,
CellStyle.BORDER_DOUBLE);
assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE,
CellStyle.BORDER_DOUBLE);
assertBorder(sheet, i++, 0, BorderStyle.THIN /* CellStyle.BORDER_THIN */, BorderStyle.THIN /* CellStyle.BORDER_THIN */, BorderStyle.THIN /* CellStyle.BORDER_THIN */,
BorderStyle.THIN /* CellStyle.BORDER_THIN */);
assertBorder(sheet, i++, 0, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */,
BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */);
assertBorder(sheet, i++, 0, BorderStyle.THICK /* CellStyle.BORDER_THICK */, BorderStyle.THICK /* CellStyle.BORDER_THICK */, BorderStyle.THICK /* CellStyle.BORDER_THICK */,
BorderStyle.THICK /* CellStyle.BORDER_THICK */);

assertBorder(sheet, i++, 0, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */,
BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */);
assertBorder(sheet, i++, 0, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */,
BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */);
assertBorder(sheet, i++, 0, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */, BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */,
BorderStyle.DOTTED /* CellStyle.BORDER_DOTTED */);

assertBorder(sheet, i++, 0, BorderStyle.DASHED /* CellStyle.BORDER_DASHED */, BorderStyle.DASHED /* CellStyle.BORDER_DASHED */, BorderStyle.DASHED /* CellStyle.BORDER_DASHED */,
BorderStyle.DASHED /* CellStyle.BORDER_DASHED */);
assertBorder(sheet, i++, 0, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */,
BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */);
assertBorder(sheet, i++, 0, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */,
BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */, BorderStyle.MEDIUM_DASHED /* CellStyle.BORDER_MEDIUM_DASHED */);

assertBorder(sheet, i++, 0, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */,
BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */);
assertBorder(sheet, i++, 0, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */,
BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */);
assertBorder(sheet, i++, 0, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */, BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */,
BorderStyle.DOUBLE /* CellStyle.BORDER_DOUBLE */);

} finally {
inputStream.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.IOException;
import java.io.InputStream;

import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
Expand All @@ -36,7 +37,7 @@ public class Borders2ReportTest extends ReportRunner {
* for the chosen cell. I don't know how to tell which takes precedence, but the
* following works for the tests I've carried out.
*/
public static void assertBorder(Sheet sheet, int row, int col, short bottom, short left, short right, short top) {
public static void assertBorder(Sheet sheet, int row, int col, BorderStyle bottom, BorderStyle left, BorderStyle right, BorderStyle top) {

Row curRow = sheet.getRow(row);
Row prevRow = (row > 0) ? sheet.getRow(row - 1) : null;
Expand Down Expand Up @@ -88,11 +89,11 @@ public void testRunReport() throws BirtException, IOException {
Sheet sheet = workbook.getSheetAt(0);
assertEquals(4, firstNullRow(sheet));

assertBorder(sheet, 1, 2, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM,
CellStyle.BORDER_MEDIUM);
assertBorder(sheet, 1, 2, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */,
BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */);

assertBorder(sheet, 1, 4, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM,
CellStyle.BORDER_MEDIUM);
assertBorder(sheet, 1, 4, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */, BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */,
BorderStyle.MEDIUM /* CellStyle.BORDER_MEDIUM */);

} finally {
inputStream.close();
Expand Down
Loading

0 comments on commit e309dbc

Please sign in to comment.