Recently upgraded from words 22.7 to 24.4 and started receiving an exception when calling shape.getImageData().getImageType() on a word document. I verified rolling back to 22.7 the issue is no longer present.
java.lang.NullPointerException: Cannot invoke "String.indexOf(String)" because "<parameter1>" is null
at com.aspose.words.internal.zzWkY.zzH(Unknown Source)
at com.aspose.words.internal.zzWkY.zzY62(Unknown Source)
at com.aspose.words.internal.zzYLj.zz0B(Unknown Source)
at com.aspose.words.internal.zzYLj.zzWzE(Unknown Source)
at com.aspose.words.internal.zzYLj.zzWUN(Unknown Source)
at com.aspose.words.internal.zzYLj.zzYNC(Unknown Source)
at com.aspose.words.zzXHy.zzYpJ(Unknown Source)
at com.aspose.words.ImageData.getImageType(Unknown Source)
@cpost Thank you for additional information. Unfortunately, I cannot reproduce the problem using the following simple code:
Document doc = new Document("C:\\Temp\\in.doc");
for (Shape s : (Iterable<Shape>)doc.getChildNodes(NodeType.SHAPE, true))
{
if (s.hasImage())
System.out.println(s.getImageData().getImageType());
}
PS: You can zip and attach document directly in the forum.
@cpost Thank you for additional information. Unfortunately, the problem is still not reproducible on my side. The provided code works fine and does not throw any exceptions.
@cpost Unfortunately, we still cannot reproduce the problem on our side. Without ability to reproduce the problem we cannot analyze it. If possible please create a simple application that will allow us to reproduce the problem.
Well, I showed you what line your null pointer is happening on. For now I guess when I call getImageType() I’ll just have to wrap it with my own error handling and return ImageType.UNKNOWN.
@cpost Unfortunately, we cannot analyze the problem without ability to reproduce it on our side. As I have mentioned the problem does not happen with your document on my side.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.