Skip to content

Commit 8155f46

Browse files
authored
JAVA-9566: Update apache-poi version and articles (eugenp#11748)
* JAVA-9566: Update apache-poi version and articles * JAVA-9566: Update apache-poi version and articles
1 parent 73addd6 commit 8155f46

File tree

7 files changed

+36
-49
lines changed

7 files changed

+36
-49
lines changed

apache-poi/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</dependencies>
3434

3535
<properties>
36-
<poi.version>4.1.1</poi.version>
36+
<poi.version>5.2.0</poi.version>
3737
<jexcel.version>1.0.6</jexcel.version>
3838
</properties>
3939

apache-poi/src/main/java/com/baeldung/poi/excel/ExcelPOIHelper.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
package com.baeldung.poi.excel;
22

3+
import java.io.File;
4+
import java.io.FileInputStream;
5+
import java.io.FileOutputStream;
6+
import java.io.IOException;
7+
import java.util.ArrayList;
8+
import java.util.HashMap;
9+
import java.util.List;
10+
import java.util.Map;
11+
312
import org.apache.poi.ss.usermodel.Cell;
4-
import org.apache.poi.ss.usermodel.CellType;
513
import org.apache.poi.ss.usermodel.CellStyle;
14+
import org.apache.poi.ss.usermodel.DateUtil;
15+
import org.apache.poi.ss.usermodel.FillPatternType;
616
import org.apache.poi.ss.usermodel.IndexedColors;
717
import org.apache.poi.ss.usermodel.Row;
818
import org.apache.poi.ss.usermodel.Sheet;
919
import org.apache.poi.ss.usermodel.Workbook;
10-
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
1120
import org.apache.poi.xssf.usermodel.XSSFFont;
12-
import org.apache.poi.ss.usermodel.DateUtil;
13-
import org.apache.poi.ss.usermodel.FillPatternType;
14-
import java.io.File;
15-
import java.io.FileOutputStream;
16-
import java.io.FileInputStream;
17-
import java.io.IOException;
18-
import java.io.InputStream;
19-
import java.util.Map;
20-
import java.util.HashMap;
21-
import java.util.ArrayList;
22-
import java.util.List;
21+
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
2322

2423
public class ExcelPOIHelper {
2524

@@ -33,7 +32,7 @@ public Map<Integer, List<String>> readExcel(String fileLocation) throws IOExcept
3332
for (Row row : sheet) {
3433
data.put(i, new ArrayList<String>());
3534
for (Cell cell : row) {
36-
switch (cell.getCellTypeEnum()) {
35+
switch (cell.getCellType()) {
3736
case STRING:
3837
data.get(i)
3938
.add(cell.getRichStringCellValue()

apache-poi/src/main/java/com/baeldung/poi/excel/ExcelUtility.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static String readExcel(String filePath) throws IOException {
4444
}
4545
}
4646
inputStream.close();
47+
baeuldungWorkBook.close();
4748

4849
} catch (IOException e) {
4950
throw e;

apache-poi/src/main/java/com/baeldung/poi/excel/cellstyle/CellStyler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.baeldung.poi.excel.cellstyle;
22

33
import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined;
4-
import org.apache.poi.ss.usermodel.Cell;
54
import org.apache.poi.ss.usermodel.CellStyle;
65
import org.apache.poi.ss.usermodel.Font;
76
import org.apache.poi.ss.usermodel.HorizontalAlignment;

apache-poi/src/test/java/com/baeldung/jexcel/JExcelIntegrationTest.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
package com.baeldung.jexcel;
22

3+
import static org.junit.Assert.assertEquals;
4+
35
import java.io.File;
4-
import java.io.FileOutputStream;
56
import java.io.IOException;
6-
import java.io.InputStream;
7-
import jxl.read.biff.BiffException;
8-
import java.util.Map;
9-
import java.util.ArrayList;
107
import java.util.List;
8+
import java.util.Map;
119

12-
import com.baeldung.jexcel.JExcelHelper;
10+
import org.junit.After;
11+
import org.junit.Before;
12+
import org.junit.Test;
1313

14-
import jxl.write.WriteException;
1514
import jxl.read.biff.BiffException;
16-
17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertTrue;
19-
20-
import org.junit.Test;
21-
import org.junit.Before;
22-
import org.junit.After;
15+
import jxl.write.WriteException;
2316

2417
public class JExcelIntegrationTest {
2518

apache-poi/src/test/java/com/baeldung/poi/excel/ExcelIntegrationTest.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
package com.baeldung.poi.excel;
22

3+
import static org.junit.Assert.assertEquals;
4+
35
import java.io.File;
4-
import java.io.FileOutputStream;
56
import java.io.IOException;
6-
import java.io.InputStream;
7-
import jxl.read.biff.BiffException;
8-
import java.util.Map;
9-
import java.util.ArrayList;
107
import java.util.List;
8+
import java.util.Map;
119

12-
import com.baeldung.poi.excel.ExcelPOIHelper;
13-
14-
import static org.junit.Assert.assertEquals;
15-
import static org.junit.Assert.assertTrue;
16-
17-
import org.junit.Test;
18-
import org.junit.Before;
1910
import org.junit.After;
11+
import org.junit.Before;
12+
import org.junit.Test;
2013

2114
public class ExcelIntegrationTest {
2215

apache-poi/src/test/java/com/baeldung/poi/excel/cellstyle/CellStyleHandlerUnitTest.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
package com.baeldung.poi.excel.cellstyle;
22

3-
import org.apache.poi.ss.usermodel.*;
4-
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
5-
import org.junit.Before;
6-
import org.junit.Test;
3+
import static org.junit.Assert.assertEquals;
74

8-
import java.io.FileOutputStream;
95
import java.io.IOException;
10-
import java.io.OutputStream;
116
import java.net.URISyntaxException;
127
import java.nio.file.Paths;
138

14-
import static org.junit.Assert.assertEquals;
9+
import org.apache.poi.ss.usermodel.Cell;
10+
import org.apache.poi.ss.usermodel.IndexedColors;
11+
import org.apache.poi.ss.usermodel.Row;
12+
import org.apache.poi.ss.usermodel.Sheet;
13+
import org.apache.poi.ss.usermodel.Workbook;
14+
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
15+
import org.junit.Before;
16+
import org.junit.Test;
1517

1618
public class CellStyleHandlerUnitTest {
1719
private static final String FILE_NAME = "cellstyle/CellStyleHandlerTest.xlsx";

0 commit comments

Comments
 (0)