Hi Łukasz,

if you replace the org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar from the distribution folder lib/jdk9plus/ with the version org.apache.servicemix.specs.activation-api-1.1-2.9.0.jar the NPE is gone, and the Content-Type "multipart/form-data" is working as expected.

Best,
Gregor

On 2022/02/02 17:59:11 Łukasz Dywicki wrote:
Hey Greg,
Looking at the stack trace it originates from an system dependency we
have and not Karaf itself. Are you able to reproduce issue without Karaf
(ie. running stock CXF), or it happens only when you deploy your service
within our runtime?

BTW would your organization be interested in providing a story for
https://karaf.apache.org/stories.html ?

Best,
Łukasz
--
Apache Karaf committer & PMC member
http://code-house.org

On 2.02.2022 17:15, Greg Logan wrote:
> Hi all,
>
> We are seeing null pointer exceptions[1] on requests after upgrading
> from 4.2.9 to 4.2.15.  The requests look like this (these are testing
> instances, passwords are public, feel free to copy and paste these
> commands):
>
> curl -vvv 'https://stable.opencast.org/api/series/
> <https://stable.opencast.org/api/series/>' \
>   -u admin:opencast \
>   -F 'metadata=[{"label":"Opencast Series
>
Dublincore","flavor":"dublincore\/series","fields":[{"id":"title","value":"Test"}]}]'
> \
>   -F
>
'acl=[{"allow":true,"action":"write","role":"ROLE_ADMIN"},{"allow":true,"action":"read","role":"ROLE_ADMIN"}]'
>
> A corrected request adds mimetypes to the acl and metadata fields:
>
> curl -vvv 'https://stable.opencast.org/api/series/
> <https://stable.opencast.org/api/series/>' \
>   -u admin:opencast \
>   -F 'metadata=[{"label":"Opencast Series
>
Dublincore","flavor":"dublincore\/series","fields":[{"id":"title","value":"Test"}]}];
> type=application/json' \
>   -F
>
'acl=[{"allow":true,"action":"write","role":"ROLE_ADMIN"},{"allow":true,"action":"read","role":"ROLE_ADMIN"}];
> type=application/json'
>
> Looking through the Karaf jira,
> https://issues.apache.org/jira/browse/KARAF-6703
> <https://issues.apache.org/jira/browse/KARAF-6703> caught one of our
> developer's eye, notably the comment with the same stack trace linking
> to https://issues.apache.org/jira/browse/CXF-8380
> <https://issues.apache.org/jira/browse/CXF-8380>. Looking at the jars
> in our assemblies, it looks like we have CXF 3.4.3, but this behaviour
> is supposed to be resolved by 3.4.2.  Am I confused and this is
still a
> known issue, or am I just unfamiliar with the inner workings of Karaf
> and CXF?
>
> Thanks,
> G
>
> 1: <h3>Caused by:</h3><pre>java.lang.NullPointerException: mimeType
>         at
>
java.datatransfer/java.awt.datatransfer.DataFlavor.&lt;init&gt;(DataFlavor.java:427)
>         at
>
javax.activation.ActivationDataFlavor.&lt;init&gt;(ActivationDataFlavor.java:113)
>         at
javax.activation.DataHandler.&lt;init&gt;(DataHandler.java:41)
>         at
>
org.apache.cxf.attachment.AttachmentUtil.createAttachment(AttachmentUtil.java:420)
>         at
>
org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments(MessageContextImpl.java:291)
>         at
>
org.apache.cxf.jaxrs.ext.MessageContextImpl.get(MessageContextImpl.java:79)
>         at
>
org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils.getMultipartBody(AttachmentUtils.java:84)
>         at
>
org.apache.cxf.jaxrs.utils.JAXRSUtils.processFormParam(JAXRSUtils.java:1044)
>         at
>
org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:967)
>         at
>
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:927)
>         at
>
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:842)
> ...
>

Reply via email to