You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Bert Jacobs (JIRA)" <ji...@apache.org> on 2013/07/19 16:28:50 UTC
[jira] [Commented] (GERONIMO-6484) Activation 1.1 spec:
NullPointerException in MimetypesFileTypeMap
[ https://issues.apache.org/jira/browse/GERONIMO-6484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13713707#comment-13713707 ]
Bert Jacobs commented on GERONIMO-6484:
---------------------------------------
As to the cause; the code contains the following:
{code}
ClassLoader cl = MimetypesFileTypeMap.class.getClassLoader();
{code}
In special cases like the one I use (a jar in an endorsed dir) {{getClassLoader()}} returns {{null}} because the class was loaded by the JVM classloader.
To fix this problem, check if the classloader is null. If so, use {{Classloader.getSystemClassloader()}} instead.
> Activation 1.1 spec: NullPointerException in MimetypesFileTypeMap
> -----------------------------------------------------------------
>
> Key: GERONIMO-6484
> URL: https://issues.apache.org/jira/browse/GERONIMO-6484
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: specs
> Reporter: Bert Jacobs
>
> I'm using Karaf 2.3.2.
> The endorsed directory contains the ServiceMix org.apache.servicemix.specs.jaxb-api-2.2-2.2.0 bundle which in turn includes a shaded version of geronimo-activation_1.1_spec version 1.0.2.
> My code uses a FileDataSource, requests the content type and receives this:
> {noformat}
> Caused by: java.lang.NullPointerException
> at javax.activation.MimetypesFileTypeMap.<init>(MimetypesFileTypeMap.java:62)[:2.2.0]
> at javax.activation.FileTypeMap.getDefaultFileTypeMap(FileTypeMap.java:53)[:2.2.0]
> at javax.activation.FileDataSource.getContentType(FileDataSource.java:69)[:2.2.0]
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira