Sola-ris created CXF-9113:
-----------------------------
Summary: EntityPart.Builder does not seem to work in a Java SE
environment
Key: CXF-9113
URL: https://issues.apache.org/jira/browse/CXF-9113
Project: CXF
Issue Type: Bug
Components: JAX-RS
Affects Versions: 4.1.0
Reporter: Sola-ris
Attempting to build an EntityPart in a Java SE environment like e.g. a JUnit
test always fails with a NullPointerException
*To reproduce:*
{code:java}
EntityPart.withName("greeting")
.content("hello")
.build();
{code}
*Stacktrace:*
{noformat}
java.lang.NullPointerException: Cannot invoke
"org.apache.cxf.message.Message.getExchange()" because "m" is null
at
org.apache.cxf.jaxrs.provider.ServerProviderFactory.getInstance(ServerProviderFactory.java:124)
at
org.apache.cxf.jaxrs.impl.EntityPartBuilderImpl.build(EntityPartBuilderImpl.java:111)
at
org.example.EntityPartReproducerTest.testBuildEntityPart(EntityPartReproducerTest.java:15)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
{noformat}
[Executable reprodcucer|https://github.com/Sola-ris/cxf-reproducers]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)