Getting the ArrayIndexOutOfBoundsException: 0 -- MS2010 XLSX to PDF Conversion in Oracle Application Server

Hi, The patch did not make any difference. The only difference is the error message and trace are not written in the log file now. Did you fix anything or did you make any changes related to logging? Can you reproduce the issue in OAS or do let me know if you want to setup a conf call to discuss?

Hello,



We have the high priority support agreement with Aspose.

The solution provided is not working for our environment.



Please let me know how we can escalate this issue to make the code work on our Oracle Application Server environment.



Can we set up a WebEx session to show the issue?



Otherwise, what are next steps to resolve this issue ASAP for our environment?



Thank you,



Dale Parkinson

GE Healthcare Agile PDM System Owner

Hi Dale,


We deeply regret any inconvenience caused.

We have handled the Exception [ArrayIndexOutOfBoundsException] mentioned in your original post and provided the Aspose.Cells for .NET v2.5.4.9 with this fix. If you are getting the same exception then you must be able to log it. Please provide these log files. If there is no exception then please share what kind of problem are you facing while integrating your OAS with Aspose.Cells Java API.

As communicated earlier, there can be some other reasons that we are unable to figure out from the exception logs. In order to set up a conference call or WebEx session, we have attached your feedback to the Ticket associated with this thread. As soon as we receive any updates, we will post them here for your reference.

Meanwhile, it would be of great help to us if your elaborate your problem with screenshots and/or brief description.

Thank you for your patience.

Please refer to the code and log below

code :
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Workbook workbook = new Workbook();

workbook.open(“d:\\stamp.xls”);

SaveOptions saveop = workbook.getSaveOptions();

saveop.setOnePagePerSheet(true);

saveop.setFontPath(new String[]{"/apps/ge/fonts"});

workbook.save(“d:\\stamp.pdf”, FileFormatType.PDF);

log : aspose_log.txt(attached )

Output file: stamping_xlsx.pdf(Attached)

Input File: Stamping.xlsx(attached)




Just to correct the statements… The directories are solaris directories and the code is
Workbook workbook = new Workbook();
workbook.open(“/apps/ge/stamp.xls”);
SaveOptions saveop = workbook.getSaveOptions();
saveop.setOnePagePerSheet(true);
saveop.setFontPath(new String[]{"/apps/ge"});
workbook.save(“/apps/ge/stamp.pdf”, FileFormatType.PDF);

Hi Aravind,


Thank you for your help.
I have attached the sample input and output files along with the log files to the ticket associated with this thread. Hopefully soon we will get back to you on this after analysing the logs.

Hi,

From your new log information, we think the exception is now caused by the invalid pdf file which may be created by your code like


workbook.save("/apps/ge/stamp.pdf", FileFormatType.PDF);


Previous exceptions was caused by Workbook.open() method and we have caught it in the new fix. As we had said, it seems that there are some other problems while reading/saving files in your environment with aspose.cells component. But it is really hard for us to figure the issue out because we have no such environment to reproduce the issue. We have tested your template file with oc4j server, the file can be read and re-saved fine. To trace the issue, would you please check whether the data has been read successfully from your template file? Such as, add some output in your code like:

Java

Workbook workbook = new Workbook();
workbook.open("/apps/ge/stamp.xls");
Cells cells = workbook.getWorksheets().getSheet(0).getCells();
for(int i=0; i<6; i++) {
Cell cell= cells.getCell(i, 0);
System.out.println(cell.getName() + ":" + cell.getValue()); }
SaveOptions saveop = workbook.getSaveOptions();
saveop.setOnePagePerSheet(true);
saveop.setFontPath(new String[]{"/apps/ge"});
workbook.save("/apps/ge/stamp.pdf", FileFormatType.PDF);


Hi,

We have executed the code. Please refer to the attached log file, xlsx and pdf file. Do let me know if you need anything else.Looks like there is a problem with reading the text from the xlsx file.

Thanks
Aravind

Hi,

Thanks for your feedback. I have logged your comment. We will look into this issue and update you asap.

The comment has been logged inside the issue id: CELLSJAVA-28609

Hi,

From your new log file we can see that no cells data be read successfully from the template file. Just same as we have thought, there are other problems in the read process. Also there must be some problems with the save process too because your generated pdf is corrupted too. Commonly even an empty workbook, the generated pdf file should not be corrupted. Sot we think there may be some compatibility problems for your server and the jars of aspose. Unfortunately we have no such kind of environment to reproduce and trace the issue. So we have to provide some other debug versions and ask your help to execute it and send us back the debug messages.

Please download: aspose-cells-2.5.4.10D.jar

Hi,

Applied the patch and attached are the log file, xlsx and pdf files.

Aravind

Hi,

Thanks for your feedback and files. We have saved it in our log and after investigating it, we will update you asap.

Hi,

Please try this new debug version (V2.5.4.12D) and send us the output messages. It seems those string values used by cells have not been processed by dom4j’s handler.

Please download: aspose-cells-2.5.4.12D.zip

Thanks Faiz! Its working now, but we need to test more and will get back to you.

Could you also look into the other issue which we reported?

<A href="https://forum.aspose.com/t/86114</A></P> <P>This is same problem with PPTX. Hope this can be resolved quickly as XSLX issue is resolved now.</P> <P>Thanks!</P> <P>Aravind</P> <P> </P>

Hi,

Its good things are going ok so far.

For your Aspose.Slides problem, I am afraid, you will have to post your request on the Aspose.Slides forum.

Aspose.Slides support team will help you asap.

Hi,

Thank you for your feedback and we are glad to know that your issue may be resolved in some way. However, we still need your help to trace this issue further so that we can get the root cause of it and get the best way to remove all potential issues of same kind. So please use this new debug version(V2.5.4.12D1) in your application and check whether it can work, also please send us back the output message. When we find the root cause of this issue, we can also share our findings with slides team so that your similar issue with pptx may be resolved too.

Hi,

I have tested with the following jar files and below are the findings

Case 1

Initial jar file aspose-cells-2.5.2.jar.

This works with XLS and data is copied correctly. Does not work with XLSX.

Case 2

With aspose-cells-2.5.4.12D.jar

This file works for both XLS and XLSX, but data is truncated(all files attached). As you see there are four columns in the xls and xlsx where as final output pdf has truncated fourth column.

Case 3

With aspose-cells-2.5.4.12D1.jar I got the error

java.lang.NoSuchMethodError: org.dom4j.io.SAXReader.resetHandlers()V

I am using dom4j-1.6.1.jar file

Thanks

Aravind

Hi,

It is really strange that you got such kind of error: “java.lang.NoSuchMethodError: org.dom4j.io.SAXReader.resetHandlers()V”. From dom4j-1.6.1’s source code, jar file or javadoc you can see this method is there and we cannot find any issue with this method in our test.

So please make sure you are using the correct version of dom4j, and please test the debug version aspose-cells-2.5.4.12D1.jar in a standalone application(out of the OAS) to see whether this method can work.

At the same time, we removed the invocation of this method in the new debug version (aspose-cells-2.5.4.12D2.jar) to make the trace process forward. Please try it and send us back the debug messages.

Anyways it will be better if you can figure out the issue of “SAXReader.resetHandlers()” at your end at the same time.

For the issue that data was truncated, it is a bug of exporting pdf. We will fix it soon.

Hi,

Regarding the error NoSuchMethodError, I think OAS is using another version of dom4j jar which is not same as this one. Hence I cannot remove the jar because the code should work in OAS and if I remove default dom4j from OAS, it may create more problem. Pls continue working with aspose-cells-2.5.4.12D2.jar.

I have applied patch and below is the log. Also attached are the two files: Source file and stamped file

11/07/12 18:33:15 2.5.4.12D2-1: total si count 1

11/07/12 18:33:15 2.5.4.12D2-1:TEST FILE FOR STAMPING

11/07/12 18:33:15 start: /sst

11/07/12 18:33:15 start: /sst/si

11/07/12 18:33:15 start: /sst/si/t

11/07/12 18:33:15 end: /sst/si/t

11/07/12 18:33:15 end: /sst/si

11/07/12 18:33:15 end: /sst

11/07/12 18:33:15 2.5.4.12D2-2: total si count 1

11/07/12 18:33:15 2.5.4.12D2-2:TEST FILE FOR STAMPING

11/07/12 18:33:15 2.5.4.12D2-3: total si count 1

11/07/12 18:33:15 2.5.4.12D2-3:TEST FILE FOR STAMPING

11/07/12 18:33:15 A1:TEST FILE FOR STAMPING

11/07/12 18:33:15 A2:TEST FILE FOR STAMPING

11/07/12 18:33:15 A3:TEST FILE FOR STAMPING

11/07/12 18:33:15 A4:TEST FILE FOR STAMPING

11/07/12 18:33:15 A5:TEST FILE FOR STAMPING

11/07/12 18:33:15 A6:TEST FILE FOR STAMPING

Thanks

Aravind

Hi,

We think the root cause of this issue is of your dom4j version used by OAS. Obviously this version does not support some features provided by dom4j 1.6.1 version. Now that the debug version can work for you, we have changed our comonent in that way to make it be compatible with your enviornment and so that you need not to change the dom4j for OAS. Also we have fixed the issue that cell content be truncated when converting to pdf. Please try this new fix.

Please download: Aspose.Cells for Java v2.5.4.13