Exception when body contains "<br>& "


#1

Hello!

When trying to set MapiMessage body, which contains "<br>& " (note, that there’s a space at the end), I’m getting the following exception:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
	at java.lang.String.charAt(String.java:658)
	at com.aspose.email.yq.a(SourceFile:545)
	at com.aspose.email.yq.a(SourceFile:424)
	at com.aspose.email.yq.a(SourceFile:273)
	at com.aspose.email.bbc.g(SourceFile:333)
	at com.aspose.email.MapiMessageItemBase.setBodyContent(SourceFile:1389)

It can be reproduced with the following code snippet:

MapiMessage message = new MapiMessage();
message.setBodyContent("<html><body>Something <br>& something</body></html>", BodyContentType.Html);

Thanks!


#2

@Zeruch,

I have worked with the sample code shared by you using Aspose.Email for Java 19.3 on my end in Windows 7 with Java 8. I have not been able to reproduce the issue on my end. Can you please try using the specified version on your end.


#3

Hi @mudassir.fayyaz!

Thanks for the reply, looks like this issue was fixed in 19.2, I was using 19.1.

It’s not reproducible anymore, thanks!


#4

@Zeruch,

You are very welcome.