Getting a Null Pointer Exception while saving a workbook

Hi ,

I am getting below exception while saving a worksheet.

java.lang.NullPointerException: null
at com.aspose.cells.zih.(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.WorksheetCollection.a(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.zrd.o(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.zrd.(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.ze.b(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.zxt.b(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.ze.a_(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.zxt.a(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.Workbook.a(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.Workbook.save(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.aspose.cells.Workbook.save(Unknown Source) ~[aspose-cells-19.12.jar!/:na]
at com.ibm.pmo.projects.amerisource.PMOABCResolutionSLOReport.populateSLOBreachData(PMOABCResolutionSLOReport.java:130)
PMOAsposeService.zip (28.7 KB)

Your project shows that you are using some other libraries or APIs with Aspose.Cells for Java, so, it will be difficult to evaluate if the issue is linked to Aspose.Cells. Please isolate/separate the issue regarding Aspose.Cells and create a simplified (standalone) Java program (runnable) using Aspose.Cells APIs only to reproduce the issue on our end. You may use Excel file(s) for it (if required) and remove any inter-dependencies of other libraries. This way, we could evaluate your issue precisely and efficiently to consequently figure it out soon.

Hi,

Let me re-phrase the issue once again.

  1. I am trying to create a worksheet based on the current month and the year i.e Data_Jan_2021 and it will subsequently add the sheets based on the months.
    In these sheets i am adding some data .

  2. In other worksheet i am trying to capture the process run date and this sheet has a protection. Every time when i am running this process , i am allowing to add the current runtime date in this sheet with the below snippet:

Protection protection = processRunSheet.getProtection();
protection.setAllowEditingContent(true);

Above these 2 functionalities is working fine in my local but when its integrated with Cloud Environment its giving the above NPE.

It can’t save the named Data_Jan_2021 sheet into the workbook.

Please guide me to resolve this issue and we have this requirement adding a individual sheet based on the current month.

Thanks
Anirban

@Anirban_Roy,
We are afraid that without a runnable sample program, that can be compiled and executed here without any missing reference, we are not able to reproduce this issue here. You may please create a separate application which can be used to analyze this issue here. Your sample code is too lengthy and cannot be used to provide any assistance as it is not compilable and involves number of other libraries.

SampleCode.zip (572.4 KB)
Hi,

Please find the attached code and required input files . Please change the input files path as required.

Anirban

@Anirban_Roy,
I have resolved all the missing references in the code but not able to resolve the following:

import com.ibm.pmo.util.PMOUtils;

Could you please share this missing resource for our testing?

PMOUtils.zip (3.0 KB)
Hi,

Please find the attached.

Thanks
Anirban

@Anirban_Roy,
Thank you for providing required information. Now only following files are required to test this issue:

Response_Resolution_SLO_Breaches (14).xlsx
breaches.xlsx
aaa.xlsx
WE_23 May - 5 Jun 20 _Resolution_SLA - Modified_2ndRound_test.xlsx

Response_Resolution_SLO_Breaches (14).zip (559.0 KB)

Hi,

Please find the attached.

Thanks
Anirban

@Anirban_Roy,
I have tried this code with the supplied files but could not observe any issue. No exception is raised and following output is obtained after executing this code:

Method name getFilterConnectNowData

***** Heap utilization statistics [MB] *****

Total Memory: 182

Free Memory: 164

Used Memory: 17

Max Memory: 3641

Could you please share your environment details with us?

Navigating IBM Services Essentials _ IBM Services Essentials _ Boomerang.zip (110.3 KB)
Hi
Thanks for the update.

Attached are the docs of the environments . I also didn’t found any exception at my local but this program didn’t executed properly in Cloud Environment.

My suspect is – there is sheet which is protected with Protection causing the issue in Cloud Env.

Hope you will be giving some thoughts/input on this issue.

Thanks
Anirban

@Anirban_Roy,
We could not reproduce this issue here however it is logged in our database for further investigation. You will be notified here once any update is available for sharing.

This issue is logged as:
CELLSJAVA-43394 - Getting a Null Pointer Exception while saving a workbook

@Anirban_Roy,

We are sorry but we could not reproduce the issue with your code and files. Please try our latest version or fix (attached) to check whether the problem can be solved by new versions or not. Moreover, in your application, the memory setting is set as MEMORY_PREFERENCE, so you try to use NORMAL mode instead to see whether it can solve the issue.
aspose-cells-21.1.3-java.zip (7.2 MB)