Hello,
The attached file causes Aspose.Cells to throw a NullPointerException when constructing a Workbook object.
Workbook workbook = new Workbook(pathname);
Thanks,
Ben
java.lang.NullPointerException
at com.aspose.cells.zain.b(Unknown Source)
at com.aspose.cells.zain.a(Unknown Source)
at com.aspose.cells.zajo.j(Unknown Source)
at com.aspose.cells.zajo.a(Unknown Source)
at com.aspose.cells.zajn.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
Hi,
Thanks for the template file.
I have tested your scenario/ case using your template file and sample code with v8.5.0.2, it works fine and I do not get any exception.
Thank you.
I forgot to mention I was using the currently available version, 8.5.0.
With 8.5.0.2, the exception looks like the one below.
The only other thing I'm calling is CellsHelper.setFontDirs() and setting the license file.
Thanks,
Ben
java.lang.NullPointerException
at com.aspose.cells.zaio.b(Unknown Source)
at com.aspose.cells.zaio.a(Unknown Source)
at com.aspose.cells.zajp.j(Unknown Source)
at com.aspose.cells.zajp.a(Unknown Source)
at com.aspose.cells.zajo.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
Hi,
I am using the following sample line of code with your template file using v8.5.0.2:
e.g
Sample code:
Workbook workbook = new Workbook(“example.ods”);
Could you try the above line of code by specifying the correct ODS file path accordingly if it works fine or not. Could you paste your sample code (runnable) here, we will check it soon.
Thank you.
Thanks for checking this for me.
I'm having trouble reproducing a minimal test case. It does go wrong, but only when embedded in the application.
If you could look at the bit of code which is throwing that exception, and tell me roughly what it's doing, it would be very helpful for debugging this.
Thanks,
Ben
Hi,
I am afraid, the error "NullPointerException" has many applications, so we can't detect or predict based on mere exception trace you shared, we got to reproduce the issue on our end. We appreciate if you could provide us sample JAVA program (runnable) with our latest version/fix v8.5.0.x to reproduce the said exception on our end. After finding the issue, we may log a ticket for your issue into our database to consequently figure it out or providing the workaround (if possible) soon.
Thanks for your understanding!
I was hoping you might be able to look up the non-obfuscated class names and give me a rough idea of what to look at.
A NullPointerException in code to open a file would suggest very different things to look at than one in the middle of your file parser.
Ben
Hi,
Thanks for using Aspose.Cells.
According to the stacktrace it seems the error was not caused by reading an ODS template file but by an Ooxml template file such as xlsx. Please make sure you have given the correct template file to reproduce the issue and you have used the correct parameters(such as giving the correct file format value if you specify the file format explicitly).
Thank you, that information has enabled me to write a simple test case, below. The NullPointerException is triggered by the omission of the extension from the filename.
As a workaround, I know the MIME type of the file. Is there any way I can give Aspose.Slides a hint on which file format it's in?
Thanks,
Ben
import com.aspose.cells.Workbook;
class Test {
public static void main(String[] args) throws Exception {
Workbook workbook = new Workbook("example"); // NO EXTENSION
}
}
Note I can’t find the documentation for specifying the fileformat, and LoadFormat is effectively a blank page:
http://www.aspose.com/docs/display/slidesjava/com.aspose.slides.LoadFormat+Class
Hi,
ben.summers:
Thank you, that information has enabled me to write a simple test case, below. The NullPointerException is triggered by the omission of the extension from the filename.
As a workaround, I know the MIME type of the file. Is there any way I can give Aspose.Slides a hint on which file format it's in?
Thanks,
Ben
import com.aspose.cells.Workbook;
class Test {
public static void main(String[] args) throws Exception {
Workbook workbook = new Workbook("example"); // NO EXTENSION
}
}
Well, when I use your "example.ods" file but does not provide/specify ".ods" in the code as its file extension while giving the file path using your sample code above, it gives me error: "java.io.FileNotFoundException". Do you have different file than your original "example.ods" file you provided earlier. If you have different file, kindly do provide it here, we will check it soon.
And for:
ben.summers:
Note I can't find the documentation for specifying the fileformat, and LoadFormat is effectively a blank page:
http://www.aspose.com/docs/display/slidesjava/com.aspose.slides.LoadFormat+Class
Please post your query/ issue into Aspose.Slides forums, one of may fellow colleagues from Aspose.Slides team would help you soon there.
Thank you.
Sorry, I got confused between the Slides and Cells documentation.
To get a NullPointerException, rename the ‘example.ods’ file to ‘example’ (removing the extension) or unzip the attached file and use that.
I will try specifying the format using the Workbook(java.lang.String file, LoadOptions loadOptions) variant of the constructor, but it probably shouldn’t give this particular exception.
Thanks,
Ben
Hi,
Furthermore, as you already know the MIME type of your file (e.g “example”), so you may explicitly mention the LoadFormat type while opening the file via Aspose.Cells APIs, see the sample line of code that you may try:
e.g
Sample code:
Workbook workbook = new Workbook(“example”, new LoadOptions(LoadFormat.ODS));
And, check the documents for your reference here:
Thank you.
Hi,
Thanks for the template file.
ben.summers:I will try specifying the format using the Workbook(java.lang.String file, LoadOptions loadOptions) variant of the constructor, but it probably shouldn't give this particular exception.
Yes, please try using this constructor with LoadOptions which you may explicitly specify for ODS file format type, see my previous reply in the thread:
Thank you.