diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/pom.xml b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/pom.xml
index 5225fd0593..ba38c74121 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/pom.xml
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/pom.xml
@@ -62,6 +62,10 @@
org.apache.poi.wso2
poi-ooxml
+
+ commons-io.wso2
+ commons-io
+
@@ -116,6 +120,25 @@
org.wso2.orbit.org.apache.poi
poi-ooxml
+
+
+ org.apache.poi
+ poi-ooxml
+ 5.3.0
+ test
+
+
+ org.apache.poi
+ poi
+ 5.3.0
+ test
+
+
+ org.apache.xmlbeans
+ xmlbeans
+ 5.2.2
+ test
+
org.wso2.orbit.org.apache.commons
commons-collections4
diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExcelQuery.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExcelQuery.java
index 748af5d67e..59fde60c4b 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExcelQuery.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExcelQuery.java
@@ -110,19 +110,19 @@ private String[] extractRowData(Row row) {
continue;
}
switch (cell.getCellType()) {
- case HSSFCell.CELL_TYPE_STRING:
+ case STRING:
data[i] = cell.getRichStringCellValue().getString();
break;
- case HSSFCell.CELL_TYPE_BLANK:
+ case BLANK:
data[i] = "";
break;
- case HSSFCell.CELL_TYPE_BOOLEAN:
+ case BOOLEAN:
data[i] = String.valueOf(cell.getBooleanCellValue());
break;
- case HSSFCell.CELL_TYPE_FORMULA:
+ case FORMULA:
data[i] = "{formula}";
break;
- case HSSFCell.CELL_TYPE_NUMERIC:
+ case NUMERIC:
data[i] = processNumericValue(cell.getNumericCellValue());
break;
}
diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TDriverUtil.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TDriverUtil.java
index 5ee1f63a09..8114359b71 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TDriverUtil.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TDriverUtil.java
@@ -121,7 +121,7 @@ private static ColumnInfo[] getExcelHeaders(Connection connection,
Cell header = cellItr.next();
ColumnInfo column = new ColumnInfo(header.getStringCellValue());
column.setTableName(tableName);
- column.setSqlType(header.getCellType());
+ column.setSqlType(header.getCellType().getCode());
column.setId(header.getColumnIndex());
columns.add(column);
diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TExcelConnection.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TExcelConnection.java
index 1f6c50fdcd..f5fc5a3bc0 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TExcelConnection.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TExcelConnection.java
@@ -85,7 +85,7 @@ private Workbook createConnectionToExcelDocument(String filePath, boolean releas
} catch (FileNotFoundException e) {
throw new SQLException("Could not locate the EXCEL datasource in the provided " +
"location", e);
- } catch (IOException | InvalidFormatException e) {
+ } catch (IOException e) {
throw new SQLException("Error occurred while initializing the EXCEL datasource", e);
} catch (InterruptedException e) {
throw new SQLException("Error Acquiring the lock for the workbook path - " + filePath, e);
diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TResultSet.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TResultSet.java
index a052bcd0bf..1b1247e9ee 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TResultSet.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/TResultSet.java
@@ -43,7 +43,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
import org.wso2.micro.integrator.dataservices.sql.driver.processor.reader.DataCell;
import org.wso2.micro.integrator.dataservices.sql.driver.processor.reader.DataRow;
import org.wso2.micro.integrator.dataservices.sql.driver.processor.reader.DataTable;
@@ -227,7 +227,7 @@ public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLExcepti
if (cell == null) {
throw new SQLException("Error occurred while extracting the value");
}
- if (cell.getCellType() != Cell.CELL_TYPE_NUMERIC) {
+ if (cell.getCellType() != CellType.NUMERIC.getCode()) {
throw new SQLException("Value cannot be cast to a string");
}
return BigDecimal.valueOf(Long.parseLong(cell.getCellValue().toString()));
diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/reader/ExcelDataReader.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/reader/ExcelDataReader.java
index 8f2e785d70..1b9e8e6a9f 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/reader/ExcelDataReader.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/reader/ExcelDataReader.java
@@ -25,6 +25,7 @@
import java.util.List;
import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@@ -58,7 +59,7 @@ public void populateData() throws SQLException {
while (cellItr.hasNext()) {
Cell cell = cellItr.next();
DataCell dataCell =
- new DataCell(cellIndex + 1, cell.getCellType(), extractCellValue(cell));
+ new DataCell(cellIndex + 1, cell.getCellType().getCode(), extractCellValue(cell));
dataRow.addCell(dataCell.getColumnId(), dataCell);
cellIndex++;
}
@@ -77,13 +78,13 @@ public void populateData() throws SQLException {
*/
private Object extractCellValue(Cell cell) {
switch (cell.getCellType()) {
- case Cell.CELL_TYPE_NUMERIC:
+ case NUMERIC:
return cell.getNumericCellValue();
- case Cell.CELL_TYPE_BLANK:
- case Cell.CELL_TYPE_FORMULA:
- case Cell.CELL_TYPE_STRING:
+ case BLANK:
+ case FORMULA:
+ case STRING:
return cell.getStringCellValue();
- case Cell.CELL_TYPE_BOOLEAN:
+ case BOOLEAN:
return cell.getBooleanCellValue();
default:
return cell.getStringCellValue();
@@ -117,14 +118,14 @@ private ColumnInfo[] extractColumnHeaders(Sheet sheet) throws SQLException {
while (itr.hasNext()) {
Cell cell = itr.next();
if (cell != null) {
- int cellType = cell.getCellType();
+ CellType cellType = cell.getCellType();
switch (cellType) {
- case Cell.CELL_TYPE_STRING:
+ case STRING:
headers.add(new ColumnInfo(cell.getColumnIndex() + 1,
cell.getStringCellValue(), sheet.getSheetName(), Types.VARCHAR,
cell.getColumnIndex() + 1));
break;
- case Cell.CELL_TYPE_NUMERIC:
+ case NUMERIC:
headers.add(new ColumnInfo(cell.getColumnIndex() + 1,
String.valueOf(cell.getNumericCellValue()),
sheet.getSheetName(), Types.INTEGER,
diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/writer/ExcelDataWriter.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/writer/ExcelDataWriter.java
index f46fc55fab..974f4561c9 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/writer/ExcelDataWriter.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.sql.driver/src/main/java/org/wso2/micro/integrator/dataservices/sql/driver/processor/writer/ExcelDataWriter.java
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
import org.wso2.micro.integrator.dataservices.sql.driver.TExcelConnection;
import org.wso2.micro.integrator.dataservices.sql.driver.processor.reader.DataCell;
import org.wso2.micro.integrator.dataservices.sql.driver.processor.reader.DataRow;
@@ -62,16 +62,13 @@ public Map getData() {
}
private void commitCell(DataCell cell) {
- int cellType = cell.getCellType();
+ CellType cellType = CellType.forInt(cell.getCellType());
switch(cellType) {
- case Cell.CELL_TYPE_NUMERIC:
-
- case Cell.CELL_TYPE_BLANK:
- case Cell.CELL_TYPE_FORMULA:
- case Cell.CELL_TYPE_STRING:
-
- case Cell.CELL_TYPE_BOOLEAN:
-
+ case NUMERIC:
+ case BLANK:
+ case FORMULA:
+ case STRING:
+ case BOOLEAN:
default:
}
diff --git a/distribution/pom.xml b/distribution/pom.xml
index bcbe5ab4de..b6c2bc2663 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -152,6 +152,14 @@
org.graalvm.js
js-scriptengine
+
+ org.apache.poi
+ poi
+
+
+ org.apache.poi
+ poi-ooxml
+
diff --git a/distribution/src/assembly/bin.xml b/distribution/src/assembly/bin.xml
index 1c9afbf7b4..2bfd7c9a54 100755
--- a/distribution/src/assembly/bin.xml
+++ b/distribution/src/assembly/bin.xml
@@ -694,6 +694,9 @@
io.netty:netty-tcnative-boringssl-static
org.codehaus.woodstox:stax2-api:jar
+
+ org.apache.poi:poi:jar
+ org.apache.poi:poi-ooxml:jar
diff --git a/integration/pom.xml b/integration/pom.xml
index 4a0b87ffcc..19f5f15d34 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -802,7 +802,7 @@
42.2.12
8.2.2.jre8
0.7.2
- 2.6
+ 2.17.0
2.0.4.wso2v4
3.3.4
1.0.1
diff --git a/pom.xml b/pom.xml
index c4ffee3012..3608cad7a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1502,6 +1502,16 @@
icu4j
${icu.version}
+
+ org.apache.poi
+ poi-ooxml
+ ${poi-ooxml.version}
+
+
+ org.apache.poi
+ poi
+ ${poi.version}
+
@@ -1641,7 +1651,7 @@
1.5.1
[1.0.0,2.0.0)
1.78.1.wso2v1
- 3.17.0.wso2v1
+ 5.3.0.wso2v1
3.0.0.wso2v1
1.1.400.v20130418-1354
9.0.85
@@ -1667,7 +1677,7 @@
1.6.2.wso2v4
1.4.7-wso2v8
1.4.7
- 1.15
+ 1.17.1
0.1.0.wso2v1
3.1.0.wso2v1
1.5.0.wso2v1
@@ -1677,7 +1687,7 @@
2.6.0.wso2v1
1.0.1.wso2v2
3.17.0.wso2v1
- 3.17.0.wso2v1
+ 5.3.0.wso2v1
1.7.36
2.17.1
2.2.5.wso2v1
@@ -1765,7 +1775,7 @@
0.0.0
[4.4.0,5.0.0)
- 2.11.0
+ 2.17.0
0.0.0
1.0.0.wso2v1
@@ -1777,9 +1787,12 @@
1.8.wso2v1
0.0.0
- 3.17.0.wso2v1
+ 5.3.0.wso2v1
0.0.0
+ 5.3.0
+ 5.3.0
+
4.4.wso2v1
0.0.0
@@ -1835,7 +1848,7 @@
1.33.3.wso2v1
[1.33.1,2.0)
- 3.17.0.wso2v1
+ 5.3.0.wso2v1
0.0.0
1.33.1.wso2v2