We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

NPE in Evaluation

We currently evaluate the aspose email lib and have an evaluation licence in place.

On some systems it works,
on others we constantly get

java.lang.NullPointerException
at com.aspose.email.private.d.b.d(Unknown Source)
at com.aspose.email.private.d.a.(Unknown Source)
at com.aspose.email.private.d.b.j(Unknown Source)
at com.aspose.ms.System.H.a(Unknown Source)
at com.aspose.email.fi.createMapiNode(Unknown Source)
at com.aspose.email.MapiMessageReader.readMessage(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.load(Unknown Source)


or
java.lang.ExceptionInInitializerError
at com.aspose.email.aD.a(Unknown Source)
at com.aspose.email.aD.a(Unknown Source)
at com.aspose.email.gl.c(Unknown Source)
at com.aspose.email.gl.a(Unknown Source)
at com.aspose.email.gl.a(Unknown Source)
at com.aspose.email.gl.b(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.load(Unknown Source)


Test file is attached, but it happens with every mail msg or eml format

Sun JDK Java 1.6.20 or 1.6.31, same error. The extraction is done in a web application running inside tomcat 6.0.35.

Aspose.Email 1.6.0

I would be glad if there would be any hint available?

thx

OK

using the java options -Duser.country=DE causes the above error, while setting -Duser.country=US makes it run correct.

Anyway Aspose - there should be no impact on the library concerning the environment or startup options. If you could add this to your buglist it would be great.





Hi LotharMaerkle,


First of all accept my apology for late reply.

Thank you very much to bring this issue to our knowledge. We will regenerate the scenario and test it here. If found then we will raise a ticket to our development team.

Any update in this regard will be intimated to you.

Thanks again for evaluating Aspose.Email

Best Regards

Are there any updates on the issue? I would really like to drop the -Duser.country=US requirement

Hi LotharMaerkle,


We are sorry for the inconvenience you are facing since a long time.

I have gone through the above posts and find no hint about the lines of code that generate such exception. Moreover, I see that you have reported this problem with an old version of Aspose.Email for Java i.e. 1.6.0, while the current version is Aspose.Email for Java 2.3.0. Can you please try this latest version and let us know your feedback. I will try to assist you as soon as possible by investigating the issue at my end. Please don’t forget to mention the source code that leads to the generation of such error.

I retried with Aspose mail Java Version 2.3.0 - still the same issue. This is a testcase:

(Ubuntu12 Linux, Java 1.6.x)
run with java … -Duser.country=IT (or any other than US) to get the exception.

Thank you to take care of the issue.

package com.aspose.testcases.slides;

import java.io.InputStream;

import com.aspose.email.MailMessage;

public class MailCountry {
public static void main(String[] args) {
System.out.println(“country=” + System.getProperty(“user.country”));
System.out.println(“encoding=” + System.getProperty(“file.encoding”));
System.out.println(“lang=” + System.getProperty(“user.language”));
InputStream stream = MailCountry.class
.getResourceAsStream("/META-INF/mail1.msg");
MailMessage msg = MailMessage.load(stream);
}
}

output:

country=DE
encoding=UTF-8
lang=en
Exception in thread “main” java.lang.NullPointerException
at com.aspose.email.private.d.b.d(Unknown Source)
at com.aspose.email.private.d.a.(Unknown Source)
at com.aspose.email.private.d.b.j(Unknown Source)
at com.aspose.email.ms.System.H.a(Unknown Source)
at com.aspose.email.fj.createMapiNode(Unknown Source)
at com.aspose.email.MapiMessageReader.readMessage(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.load(Unknown Source)
at com.aspose.testcases.slides.MailCountry.main(MailCountry.java:15)


Hi LotharMaerkle,


We are sorry for the delayed response.

I am currently investigating this issue and will soon share my findings with you. Your patience in this regard is highly appreciated.

Hi LotharMaekle,


Thank you for being patient.

It seems that US is the default locale settings and it has its DUser.Language and DUser.Variant already set. That is why if you try any other option with only Duser.Country changed, it gives the exception as you are getting. In my opinion, if you are changing the local settings, you need to specify its other companion settings as well.

If I try changing only the DUser.country, then I get the exception as you have mentioned. However, if I set the remaining options as well, everything goes well. Here are the options that I tried and didn’t get any exception:
  • DUser.Country=DE, DUser.Language=de, DUser.Variant=EURO
  • DUser.Country=TH, DUser.Language=th, DUser.Variant=TH
Please try these at your end and let us know your feedback.

Thanks for working this out. So I understand it was not possible to create a valid Locale object?


Like there is no DE_en locale but there is CH_de.

Hi,


From your reply, I am not sure if my earlier post was helpful for you or not? I put some time to find out about various local information available and got this useful LINK that served as a resolution for the issue you mentioned.

If your requirements are different, please share more details with us and I will try to assist you further to my best.

You have provided a solution for me, this is fine. However I think you should file it as a bug, as - in my opinion - a NullPointerException indicates a programming error and therefore the lib should throw a more meaningful exception.


And, there are use cases where it may make sense to have a country like DE and a language with en setting.

Regards.

Hi LotharMaekle,


Thank you for the feedback.

Its good to know that your long lasting issue has been resolved now. I will investigate the issue of NPE with the development team and proceed further on this.

Can you please provide some use cases having country like DE and language settings as en? I will discuss it with development team and log it as an enhancement accordingly.