StyleFlag sf = new StyleFlag();
sf.setFontName(true);
sf.setFontSize(true);
sf.setBorders(true);
compRange.applyStyle(style, sf);
}
} catch (Exception ex) {
LOG.error("Error in AsposeUtil.setBorders() ", ex);
throw new ServiceException("Error in AsposeUtil.setBorders() ", ex);
}
}
But I am getting below exception :
[2014-11-03 09:11:52,046] ERROR AsposeUtil(setBorders:1060): Error in AsposeUtil.setBorders()
java.lang.NullPointerException
at com.aspose.cells.Style.setBorder(Unknown Source)
at com.rsi.report.util.AsposeUtil.setBorders(AsposeUtil.java:1050)
at com.rsi.reportserver.aspose.renderer.AsposeCommonReportServerRenderer.appyFormatingAfterSubTotal(AsposeCommonReportServerRenderer.java:3520)
at com.rsi.reportserver.aspose.renderer.AsposeRollingPeriodReportServerRenderer.processContents(AsposeRollingPeriodReportServerRenderer.java:170)
at com.rsi.reportserver.aspose.renderer.AsposeRollingPeriodReportServerRenderer.run(AsposeRollingPeriodReportServerRenderer.java:238)
at com.rsi.reportserver.processor.RollingPeriodReportRenderer.renderReport(RollingPeriodReportRenderer.java:32)
at com.rsi.reportserver.processor.ReportRenderer.processReport(ReportRenderer.java:73)
at com.rsi.reportserver.service.ReportServerHelper.processReport(ReportServerHelper.java:476)
at com.rsi.reportserver.service.ReportServerHelper.processReport(ReportServerHelper.java:443)
at com.rsi.reportserver.service.ReportServerServiceImpl.processReport(ReportServerServiceImpl.java:105)
at com.rsi.report.service.ReportGenerationJob.execute(ReportGenerationJob.java:297)
at com.rsi.core.job.service.jobengine.JobRunShell$2.process(JobRunShell.java:117)
at com.rsi.core.job.service.jobengine.TransactionTask.call(TransactionTask.java:29)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
This error get generated very less time, not every call will generate this exception.
If possible, could you please help me to check which code will throw this exception.
Well, to evaluate your issue properly, we need to simulate the issue on our end. Please create a sample console demo JAVA program (runnable) to replicate your issue on our end (you may also attach the template file if any), so we could look into it and log a ticket for the issue (if found) into our database to figure it out soon.
Actually we are facing this nullpointer exception issue on production environment. If I use same input on my local environment and run the code, not getting this exception.
I am also unable to replicate that issue locally.
As per stack trace its throwing exception in setBorder() method. This method using all ASPOSE standard API.
Do you have any guess, from where we can get this null pointer exception.
Please once again have look on setBorder() method which I provided earlier.
We have evaluated your issue a bit, I am afraid, we could not find the possible cause(s) for such kind of the issue you mentioned. We will do more investigation later on though. We may give you further reply as soon as we find some clue for your issue. We may also need more things and other details from your side as well.
Which version of Aspose.Cells are you using? If possible please test it with the latest versions of Aspose.Cells for JAVA to check whether this issue has been fixed. For some older versions’, setting border for BorderType.HORIZONTAL and BorderType.VERTICAL may cause such kind of exception, but it should not occur with recent versions. Also you can just remove the lines of code:
e.g Sample code:
Good to know that it is working fine with v8.0.1 as well. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.
We recommend and request you to test your issue with the latest versions of Aspose.Cells for JAVA (v8.2.1) to check whether it is fixed in it or got the same issue on your production server.
It seems the version you are using should not give such exception for setting border for BorderType.HORIZONTAL and BorderType.VERTICAL. Unfortunately, we cannot find the possible cause of such an exception in Style.setBorder() by analyzing the Style.setBorder() method only. Was the workbook(compRange.getWorksheet().getWorkbook()) created from one template file? If so, please send us the template file too, maybe the issue is related with some special template file. Furthermore, if you have other operations on the workbook/style before setting the borders, please simulate those operations as much as possible in your test case, that may also help us to reproduce the issue or analyze the possible cause of it. And you can also try our proposal of removing the code of setting border for BorderType.HORIZONTAL and BorderType.VERTICAL. And you can try our latest version too to see whether the issue has been solved by the new version or not.
Could you please update us, in which jar you fixed the issue related to BorderType horizontal and vertical?
We are facing issue after using ASPOSE latest 8.2.0.4.jar as well.
Still I am unable to reproduce issue locally.
Yes we are using the template file to create workbook.
I tried on my local environment by using QA env template as well, but unable to reproduce it.
Don’t think so its template related issue.
Please update us : in which version fixed setborder related issue?
Well, for the issue of setting horizontal/vertical
border, it should have been fixed from v7.1.0 and later versions.
Would you please confirm that v8.2.0.4 gives
this exception but v8.2.0.3 or v8.2.0.0 can work fine for your application? It
may help us to figure the issue out if we could know from which version the
behavior changes.
Also please confirm that the issue randomly
occurs for different template files. We doubt it is a template related issue
because of one possibility: if borders of workbook’s default style are
not instantiated completely when reading template file, NPE (NullPointerException) may be thrown for
your code. If it is not related to special template file, please check whether
it is only related to one special file format(such as XLS, XLSX, XLSX... etc.). The
more details we can get about the issue, it will be easier for us to figure the
issue out.
By the way, did you test the case with removing
the code for setting horizontal/vertical borders? if not kindly do it and let us know the results as well.