[
https://issues.apache.org/jira/browse/KARAF-6703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17307053#comment-17307053
]
Grzegorz Grzybek commented on KARAF-6703:
-----------------------------------------
A little investigation about Activation API:
I had problem with CXF and attachments:
{noformat}
Caused by: java.lang.NullPointerException: mimeType
at java.awt.datatransfer.DataFlavor.<init>(DataFlavor.java:430)
at
javax.activation.ActivationDataFlavor.<init>(ActivationDataFlavor.java:113)
at javax.activation.DataHandler.<init>(DataHandler.java:41)
at
org.apache.cxf.jaxrs.provider.MultipartProvider$MessageBodyWriterDataHandler.<init>(MultipartProvider.java:448)
at
org.apache.cxf.jaxrs.provider.MultipartProvider.getHandlerForObject(MultipartProvider.java:401)
at
org.apache.cxf.jaxrs.provider.MultipartProvider.getHandlerForObject(MultipartProvider.java:409)
at
org.apache.cxf.jaxrs.provider.MultipartProvider.createDataHandler(MultipartProvider.java:353)
at
org.apache.cxf.jaxrs.provider.MultipartProvider.createDataHandler(MultipartProvider.java:327)
at
org.apache.cxf.jaxrs.provider.MultipartProvider.getAttachments(MultipartProvider.java:311)
...
{noformat}
{{javax.activation.DataHandler}} constructor is fascinating.
In what I think that should be canonical (at least for JDK8):
*
[hg.openjdk.java.net/jdk8u/jdk8u/jaxws|http://hg.openjdk.java.net/jdk8u/jdk8u/jaxws/file/2534e08d1f08/src/share/jaf_classes/javax/activation/DataHandler.java]
* [github.com/javaee/activation, 1.2.0
tag|https://github.com/javaee/activation/blob/JAF-1_2_0/activation/src/main/java/javax/activation/DataHandler.java]
* [github.com/eclipse-ee4j/jaf, 1.2.2
tag|https://github.com/eclipse-ee4j/jaf/blob/1.2.2/activation/src/main/java/javax/activation/DataHandler.java]
we have:
{code:java}
public DataHandler(DataSource ds) {
// save a reference to the incoming DS
dataSource = ds;
oldFactory = factory; // keep track of the factory
}
{code}
SMX version of
org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.2.1/1.2.1_3
but also
org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.9.0
{code:java}
public DataHandler(DataSource ds) {
this.ds = ds;
this.flavor = new ActivationDataFlavor(ds.getContentType(), null);
}
{code}
where {{javax.activation.ActivationDataFlavor}} extends
{{java.awt.datatransfer.DataFlavor}} and AWT's DataFlavor has:
{code:java}
public DataFlavor(String mimeType, String humanPresentableName) {
super();
if (mimeType == null) {
throw new NullPointerException("mimeType");
}
{code}
But even:
* [javax/activation/DataHandler.java in JDK
6|http://hg.openjdk.java.net/jdk6/jdk6/jaxws/file/4b3bab9533cd/drop_included/jaf_src/src/javax/activation/DataHandler.java]
* [javax/activation/DataHandler.java in JDK
7|http://hg.openjdk.java.net/jdk7u/jdk7u/jaxws/file/4a302acff4de/src/share/jaf_classes/javax/activation/DataHandler.java]
have:
{code:java}
public DataHandler(DataSource ds) {
// save a reference to the incoming DS
dataSource = ds;
oldFactory = factory; // keep track of the factory
}
{code}
The SMX version of activation API comes from
org.apache.geronimo.specs/geronimo-activation_1.1_spec and was added with
DataHandler(DataSource ds) constructor that uses ActivationDataFlavor in
https://issues.apache.org/jira/browse/GERONIMO-2466 [back in
2006|https://github.com/apache/geronimo-specs/commit/70028d2cce20067e79d8a15f4bea4998f3f1f918].
DataHandler.java from activation API 1.1 is a copy of DataHandler.java from
activation API 1.0.2 in Geronimo specs repository and ActivationDataFlavor
usage dates [back to
2004|https://github.com/apache/geronimo-specs/commit/af8f64656e3386f7c26f2b61b403a98a8be19d93]
where the track is lost - I don't have any reference to Jira/BZ number in this
commit...
Long story short: SMX version of Activation API is wrong.
> Spec features and cleanup
> -------------------------
>
> Key: KARAF-6703
> URL: https://issues.apache.org/jira/browse/KARAF-6703
> Project: Karaf
> Issue Type: Task
> Components: karaf
> Reporter: Francois Papon
> Assignee: Jean-Baptiste Onofré
> Priority: Major
>
> As already discussed, we should remove the lib/jdk9plus folder and all spec
> packages from etc/jre.properties to use spec features instead.
> That will give us more control in the specs version and support of JDK.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)