Free Support Forum - aspose.com

JsonDataSource throws NullPointerException using Java

Dear Aspose team,

I’m facing a nullPointer exception in the aspose words library in the construction of the JsonDataSource object. Which occurs internally in the aspose 20.9 code.

Aspose version: 20.9, Java11.

Usecase: generation of PDF’s using a json as data source and custom template via ReportEngine.build.

Attached a sample project reproducing the nullpointer: stacktrace:

Exception in thread “main” java.lang.NullPointerException
at com.aspose.words.net.System.Data.zzS.zzZ(Unknown Source)
at com.aspose.words.net.System.Data.zzS.zzZ(Unknown Source)
at com.aspose.words.net.System.Data.zzS.zzZ(Unknown Source)
at com.aspose.words.net.System.Data.zzS.zzY(Unknown Source)
at com.aspose.words.net.System.Data.zzS.zzYgx(Unknown Source)
at com.aspose.words.net.System.Data.DataSet.readXml(Unknown Source)
at com.aspose.words.net.System.Data.DataSet.readXml(Unknown Source)
at com.aspose.words.net.System.Data.DataSet.readXml(Unknown Source)
at com.aspose.words.internal.zzJX.zzZ(Unknown Source)
at com.aspose.words.internal.zzJX.zzZ(Unknown Source)
at com.aspose.words.internal.zzJX.(Unknown Source)
at com.aspose.words.JsonDataSource.(Unknown Source)
at com.aspose.words.JsonDataSource.(Unknown Source)
at documentgenerator.DocumentGenerator.documentGenerator(DocumentGenerator.java:21)
at documentgenerator.DocumentGenerator.main(DocumentGenerator.java:15)

Cause: Aspose can’t handle case sensitivity in the JsonDataSource when having similar keys with different cases.

You can find a asposeNullPointer.json in the zip that holds 4 content objects, content object 1 till 3 is with “keywithUPPERCASE” and content object 4 with “keywithuppercase” (=lowercase).

When you make all 4 keys the same case the code does work flawless. Proving the case sensitivity cause.

Can you investigate this as this is blocking in our report generation. we can’t change our input json.

Thanks, Jeffrey

asposeNullPointerSample.zip (31.5 KB)

@Jeffrey1

We have logged this problem in our issue tracking system as WORDSJAVA-2512. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

thanks tahir, I look forward hearing.