https://bz.apache.org/bugzilla/show_bug.cgi?id=61374
Bug ID: 61374
Summary: this exception should never happen, if you read this
message please send a mail to the developers team.
Product: POI
Version: 3.16-FINAL
Hardware: Other
OS: other
Status: NEW
Severity: normal
Priority: P2
Component: OPC
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
We are getting the following error when attempting to open an Excel file that
is running under CICS in an environment with EBCDIC as the default encoding. We
only see this error under CICS, and do not see this issue running in ASCII
environments.
org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Package.init() :
this exception should never happen, if you read this message please send a mail
to the developers team.
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:136)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:54)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:81)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:220)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
at
org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:186)
at com.optum.cire.tops.rdp.ReferenceDataProvider.parseXlsRDP(Unknown
Source)
at com.optum.cire.tops.rdp.ReferenceDataProvider.<init>(Unknown Source)
at com.optum.cire.tops.rdp.ReferenceDataProvider.getInstance(Unknown
Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
Here is the latest version of the code we are using to open the file.
private void parseXlsRDP(String fileName, HashSet<String> set) {
try {
Properties p = System.getProperties();
p.put("file.encoding","ISO8859-1");
System.setProperties(p);
InputStream inputStream =
getClass().getResourceAsStream(fileName);
XSSFWorkbook exWorkBook= new XSSFWorkbook(inputStream);
XSSFSheet sheet = exWorkBook.getSheetAt(0);
XSSFFont wbFont;
wbFont=exWorkBook.createFont();
wbFont.setCharSet(HSSFFont.ANSI_CHARSET);
Row row;
Cell cell;
Cell cell1;
int noOfColumns = 0;
for (int rowIndex = 0; rowIndex <=
sheet.getLastRowNum(); rowIndex++) {
row = sheet.getRow(rowIndex);
if (row != null) {
noOfColumns =
sheet.getRow(0).getLastCellNum();
if (noOfColumns == 2) {
cell = row.getCell(0);
cell1 = row.getCell(1);
if (CellType.STRING ==
cell.getCellTypeEnum() && CellType.STRING == cell1.getCellTypeEnum())
set.add(new
String(cell.getStringCellValue().getBytes(Charset.forName("UTF-8")))+ new
String(cell1.getStringCellValue().getBytes(Charset.forName("UTF-8"))));
else if (CellType.NUMERIC ==
cell.getCellTypeEnum() && CellType.STRING == cell1.getCellTypeEnum())
set.add(new
String(String.valueOf(cell.getNumericCellValue()).getBytes(Charset.forName("UTF-8")))+
new String(cell1.getStringCellValue().getBytes(Charset.forName("UTF-8"))));
else if (CellType.NUMERIC ==
cell.getCellTypeEnum()&& CellType.NUMERIC == cell1.getCellTypeEnum())
set.add(new
String(String.valueOf(cell.getNumericCellValue()).getBytes(Charset.forName("UTF-8")))+
new
String(String.valueOf(cell1.getNumericCellValue()).getBytes(Charset.forName("UTF-8"))));
else if (CellType.STRING ==
cell.getCellTypeEnum() && CellType.NUMERIC == cell1.getCellTypeEnum())
set.add(new
String(cell.getStringCellValue().getBytes(Charset.forName("UTF-8")))+ new
String(String.valueOf(cell1.getNumericCellValue()).getBytes(Charset.forName("UTF-8"))));
} else {
for (int colIndex = 0; colIndex
< noOfColumns; colIndex++) {
cell =
row.getCell(colIndex);
if (CellType.NUMERIC ==
cell.getCellTypeEnum())
set.add(new
String(String.valueOf((long)
cell.getNumericCellValue()).getBytes(Charset.forName("UTF-8"))));
else if
(CellType.STRING== cell.getCellTypeEnum())
set.add(new
String(cell.getStringCellValue().getBytes(Charset.forName("UTF-8"))));
}
}
}
}
inputStream.close();
exWorkBook.close();
//System.out.println(":: ReferenceDataProvider ::
parseXlsRDP :: Name: "+fileName+" File size read: "+set.size());
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]