NullPointerException when converting DWG to image in java


#1

I’m evaluating your product for use in my project. I was able to successfully convert some sample DWG files to tiff and pdf format in java; However saze.dwg.zip (1.3 MB) fails with the following stacktrace:

foo.bar.test.ApplicationKt.main(Application.kt:26)
at com.aspose.cad.Image.a(Unknown Source)
at com.aspose.cad.fileformats.cad.CadImage.a(Unknown Source)
at com.aspose.cad.Image.save_internalized(Unknown Source)
… 4 more
Caused by: java.lang.NullPointerException
at com.aspose.cad.internal.n.K.a(Unknown Source)
at com.aspose.cad.internal.n.K.a(Unknown Source)
at com.aspose.cad.internal.eY.h.a(Unknown Source)
at com.aspose.cad.internal.eY.h.a(Unknown Source)
at com.aspose.cad.internal.eY.h.a(Unknown Source)
at com.aspose.cad.internal.eR.G.a(Unknown Source)
at com.aspose.cad.internal.eQ.f.a(Unknown Source)
at com.aspose.cad.internal.eR.p.a(Unknown Source)
at com.aspose.cad.internal.eQ.f.a(Unknown Source)
at com.aspose.cad.internal.eQ.f.a(Unknown Source)
at com.aspose.cad.internal.eQ.f.a(Unknown Source)
at com.aspose.cad.internal.eQ.c.a(Unknown Source)
at com.aspose.cad.internal.eQ.i.b(Unknown Source)
at com.aspose.cad.internal.eQ.a.a(Unknown Source)
at com.aspose.cad.internal.eQ.a.export(Unknown Source)
… 7 more

It seems like the error happens in these 5 layers of the dwg: ‘TEXT’, ‘TXT’, ‘zard’, ‘GOOSH’, ‘0’

I’m using the library version ‘19.7’. This is my code in kotlin I can provide java equivalent if necessary:

Image.load("/home/ghasemi/Desktop/saze.dwg").use { image ->
val options = CadRasterizationOptions().apply {
pageWidth = 1600f
pageHeight = 1600f
automaticLayoutsScaling = true
isNoScaling = false
}
image.save("/home/ghasemi/Desktop/output.tiff",
TiffOptions(TiffExpectedFormat.Default).apply { vectorRasterizationOptions = options })
}


#2

@ravenblackdusk,

Can you please share sample code so that we may further investigate to help you out.


#3

Sample code added.


#4

@ravenblackdusk,

I have worked with the sample file shared and have been able to observe the issue. An issue with ID CADJAVA-536 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.