Spring social and Aspose charset provider for utf7 encoding

Hi all,

I’m facing an strange issue with Spring’s RestTemplate initialization that instantiates StringHttpMessageConverter.

An exception is thrown in StringHttpMessageConverter’s constructor when loading available Charsets

public StringHttpMessageConverter()
{
    super(new MediaType("text", "plain", DEFAULT_CHARSET), MediaType.ALL);
    this.availableCharsets = new ArrayList(Charset.availableCharsets().values());
}
Caused by: sun.misc.ServiceConfigurationError: java.nio.charset.spi.CharsetProvider: Provider com.aspose.ms.java.utf7charset.provider.CharsetProvider not found
at sun.misc.Service.fail(Service.java:129)
at sun.misc.Service.access$000(Service.java:111)
at sun.misc.Service$LazyIterator.next(Service.java:273)
at java.nio.charset.Charset$1.getNext(Charset.java:319)
at java.nio.charset.Charset$1.hasNext(Charset.java: 332)
at java.nio.charset.Charset$4.run(Charset.java: 551)
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.charset.Charset.availableCharsets(Charset.java: 546)
at org.springframework.http.converter.StringHttpMessageConverter. <init> (StringHttpMessageConverter.java: 52)
at org.springframework.web.client.RestTemplate.(RestTemplate.java: 139)
at org.springframework.web.client.RestTemplate.(RestTemplate.java: 162)
at org.springframework.social.oauth1.OAuth1Template.createRestTemplate(OAuth1Template.java: 137)
at org.springframework.social.oauth1.OAuth1Template.(OAuth1Template.java: 85)
at org.springframework.social.oauth1.OAuth1Template.(OAuth1Template.java: 74)
at org.springframework.social.twitter.connect.TwitterServiceProvider.(TwitterServiceProvider.java: 31)
at org.springframework.social.twitter.connect.TwitterConnectionFactory. <init> (TwitterConnectionFactory.java: 28)

As you can note, the issue appears with the utf7 encoding and the Aspose charset provider.

Environment:
jdk1.6.20
w7 64 bits
running TestNG unit tests with Maven 2.2.1

Any idea ?

Regards.

Solved.

Just need to update to Aspose.Words 10.2.0 version.

Hi
It is perfect the problem is resolved. Please feel free to ask in case of any issues. We are always glad to help you.
Best regards,