Upgrading from Aspose.Cells for Java 8.3.1 jar to Aspose.Cells for Java 8.6.3 getting java.lang.NullPointerException

Hi,

We changed the Aspose 8.3.1 jar to Aspose 8.6.3 jar to avoid junk value issue in our application.
(Please refer this link for junk value issue:https://forum.aspose.com/t/36430).
We are getting following error in our application while using Aspose 8.6.3 jar instead of Aspose 8.3.1 jar and we are unable to
generate the report.

while accessing the below line of code only we are getting error and the
Range namedRange =
workbook.getRangeByName(NameResolver.getPhysicalRangeName(getCurrentTreeNode(),
getReportSectionDefinition().getName()));

int startRow = namedRange.getFirstRow();
int startCol = namedRange.getFirstColumn();

We are getting null in namedRange.


java.lang.NullPointerException
at com.tms.rundown.common.report.calc.MethodologyDataFiller.fillColumnTemplate(MethodologyDataFiller.java:98)
at com.tms.rundown.common.report.calc.MethodologyDataFiller.fillTemplate(MethodologyDataFiller.java:360)
at com.tms.basefw.report.filler.impl.GenericReportTabDataFiller.fillReportTab(GenericReportTabDataFiller.java:163)
at com.tms.basefw.report.filler.impl.GenericReportDataFiller.fillWorksheetForLeafNode(GenericReportDataFiller.java:301)
at com.tms.basefw.report.filler.impl.GenericReportDataFiller.fillReportData(GenericReportDataFiller.java:163)
at com.tms.basefw.report.generation.impl.ReportModelManager.prepareReport(ReportModelManager.java:435)
at com.tms.rundown.common.report.api.impl.ReportService.prepareReport(ReportService.java:190)
at com.tms.rundown.ard.app.BtableAppManager.generateBtableRundown(BtableAppManager.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at $Proxy269.generateBtableRundown(Unknown Source)
at com.tms.rundown.ard.web.RundownReportController.generateBtableReport(RundownReportController.java:735)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:473)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:410)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:126)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy238.handleRequest(Unknown Source)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.tms.basefw.web.LogFilter.doFilter(LogFilter.java:113)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at com.tms.rundown.security.web.UserIdHeaderProcessingFilter.doFilter(UserIdHeaderProcessingFilter.java:113)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at com.tms.basefw.web.SessionFilter.doFilter(SessionFilter.java:54)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)


Can you please share me the difference between the Aspose 8.3.1 jar to Aspose 8.6.3 jar and provide me the solution to resolve the
issue of NullPointerException.


Hi,


I suspect the issue “NullPointerException” might be due to your own code for the objects/variables which might not be giving valid range’s name
e.g
Sample code:

workbook.getRangeByName(NameResolver.getPhysicalRangeName(getCurrentTreeNode(),
getReportSectionDefinition().getName()));

Could you just print out the parameter(s) value for the workbook.getRangeByName() method and also send us the template file, so we could evaluate your issue precisely to figure it out soon.

Thank you.

Hi,



We used the Aspose 8.6.3 jar in the following code:





Range namedRange =

getWorkbook()

.getRangeByName(

NameResolver.getPhysicalRangeName(getCurrentTreeNode(), getReportSectionDefinition()

.getName()));







We are getting the NameResolver.getPhysicalRangeName(getCurrentTreeNode(), getReportSectionDefinition()

.getName())=allocReport3___phasecount

and the namedRange value is null.



PFA xls for the input for this code. We tried to get the particular section range but its returning null.



Provide me the solution to solve the issue.

Hi,


Thanks for the template file.

I have tested your issue with our latest version/fix: Aspose.Cells for Java v8.7.0 (please download it from Aspose site and try it), it works fine and the code is processed fine. Here is my simplest code segment that I am using:
e.g
Sample code:

Workbook workbook = new Workbook(“YjfNfReflT.xls”);

Range sectionRange = workbook.getWorksheets().getRangeByName(“allocReport3___phasecount”);

System.out.println(“Done!”);

Could you try the above code, it should work fine.

It looks like an issue with your custom provided parameters/objects (e.g “NameResolver.getPhysicalRangeName(getCurrentTreeNode(), getReportSectionDefinition()
.getName())”) which might be returning the wrong values, so you got to check it out on your end.

Thank you.

Hi,


Can you please try this in Aspose 8.6.3 and give me the solution?Because in our
application we are using 8.6.3.

Hi,


I have tested using v8.6.3, it also works absolutely fine and no exception is thrown whatsoever. Please run my code segment (in my previous post) in a separate JAVA program and let us know your result, it should work fine.

Thank you.

Hi,


Can you please provide me the link to download jar file and provide the name of the jar to use it for Aspose 8.6.3?

Hi,


Well, you may download any Aspose.Cells for Java version (e.g v8.7.0, 8.6.3 etc.) from here:
http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/default.aspx

Please extract the downloaded zipped archive to some directory, please find two JARs @ "…\JDK 1.6\lib", the names of the jars are:
e.g
aspose-cells-x.x.x.jar
bcprov-jdk16-146.jar

Please add both JARs into your classpath.

Hope, this helps a bit.

Thank you.

Hi,


We removed the Aspose 8.3.1 jar and added the Aspose 8.6.3(renamed the jar as
Aspose.cells)in lib. Apart from this,we didn’t made any changes.We are getting the correct section value but we are getting the Range value is null.

Is the problem is related to jar?If is it so,then provide me the solution to resolve the problem.

Hi,


Well, how could we provide any solution to a problem which we could not reproduce on our end? We have to reproduce the issue on our end. So, kindly provide the simplest sample code (runnable) with your template file, so we could evaluate and execute your sample code to reproduce the issue on our end. Once we reproduce the issue, we may log it into our database and our product team will fix it.

By the way, could you print the Aspose.Cells version to make sure that you are using the latest version.
e.g
Sample code:

//Instantiating a Workbook object
Workbook workbook = new Workbook();
System.out.println(CellsHelper.getVersion());

Thanks for your understanding!

Hi,


Can you please share me the link to differentiate the Aspose 8.3.1 to Aspose 8.6.3?
Is there any class changes in the new Aspose 8.6.3?

How we can get the range of one particular section in excel using Aspose 8.6.3?

Are they added any new design pattern in Aspose 8.6.3?

Hi,


Please see the documents in the Public API Changes section for your desired releases to know what APIs are added, changed or obsoleted for your complete reference:
http://www.aspose.com/docs/display/cellsjava/Migrating+from+Earlier+Versions+of+Aspose.Cells

And to know how to add, access or format ranges in an Excel sheet, see the document for your reference:
http://www.aspose.com/docs/display/cellsjava/Named+Ranges

Thank you.