You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2026/01/28 02:44:45 UTC
(cxf) branch 4.1.x-fixes updated (9a0f976deb -> 757cadc7d0)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a change to branch 4.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
from 9a0f976deb Recording .gitmergeinfo Changes
new 6f45097ec9 CXF-9178: Run Jakarta RESTful Web Services 4.0 TCK
new 757cadc7d0 CXF-9178: Run Jakarta RESTful Web Services 4.0 TCK
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../main/java/org/apache/cxf/jaxrs/impl/EntityPartImpl.java | 10 ++++++++++
.../java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java | 6 ++++--
2 files changed, 14 insertions(+), 2 deletions(-)
(cxf) 01/02: CXF-9178: Run Jakarta RESTful Web Services 4.0 TCK
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 4.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 6f45097ec97409979c712a4e6c8aec0d270ecd09
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Mon Jan 26 22:01:01 2026 -0500
CXF-9178: Run Jakarta RESTful Web Services 4.0 TCK
---
.../main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java
index 4323ede07c..3a962b08dd 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java
@@ -164,9 +164,11 @@ public class EntityPartProvider extends AbstractConfigurableProvider
final String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"", "").replace("'", "");
if (!StringUtils.isEmpty(fileName)) {
- return new EntityPartImpl(providers, name, fileName, is, c, genericType, headers, mediaType);
+ return new EntityPartImpl(providers, name, fileName, is, c, genericType, headers,
+ attachment.getContentType());
} else {
- return new EntityPartImpl(providers, name, null, is, c, genericType, headers, mediaType);
+ return new EntityPartImpl(providers, name, null, is, c, genericType, headers,
+ attachment.getContentType());
}
} else {
throw ExceptionUtils.toBadRequestException(null, null);
(cxf) 02/02: CXF-9178: Run Jakarta RESTful Web Services 4.0 TCK
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 4.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 757cadc7d06f40532471b53f7f4e8e11c9396100
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Tue Jan 27 21:34:22 2026 -0500
CXF-9178: Run Jakarta RESTful Web Services 4.0 TCK
(cherry picked from commit 8896c46df2b22969968d6ca380ee291e07071334)
---
.../main/java/org/apache/cxf/jaxrs/impl/EntityPartImpl.java | 10 ++++++++++
.../java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java | 4 ++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/EntityPartImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/EntityPartImpl.java
index 0c1a68a3f6..bce0850ce0 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/EntityPartImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/EntityPartImpl.java
@@ -30,6 +30,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;
import java.util.Optional;
+import java.util.concurrent.atomic.AtomicBoolean;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.EntityPart;
@@ -49,6 +50,7 @@ public class EntityPartImpl implements EntityPart {
private final GenericType<?> genericType;
private final Class<?> type;
private final Providers providers;
+ private final AtomicBoolean consumed = new AtomicBoolean();
//CHECKSTYLE:OFF
public EntityPartImpl(Providers providers, String name, String fileName, Object content, Class<?> type,
@@ -124,6 +126,10 @@ public class EntityPartImpl implements EntityPart {
public <T> T getContent(Class<T> asType) throws IllegalArgumentException, IllegalStateException,
IOException, WebApplicationException {
+ if (consumed.compareAndExchange(false, true)) {
+ throw new IllegalStateException("Content has been consumed already");
+ }
+
if (asType == null) {
throw new NullPointerException("The type is required");
}
@@ -152,6 +158,10 @@ public class EntityPartImpl implements EntityPart {
public <T> T getContent(GenericType<T> asType) throws IllegalArgumentException, IllegalStateException,
IOException, WebApplicationException {
+ if (consumed.compareAndExchange(false, true)) {
+ throw new IllegalStateException("Content has been consumed already");
+ }
+
if (asType == null) {
throw new NullPointerException("The generic type is required");
}
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java
index 3a962b08dd..f38a8a449a 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java
@@ -164,10 +164,10 @@ public class EntityPartProvider extends AbstractConfigurableProvider
final String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"", "").replace("'", "");
if (!StringUtils.isEmpty(fileName)) {
- return new EntityPartImpl(providers, name, fileName, is, c, genericType, headers,
+ return new EntityPartImpl(mc.getProviders(), name, fileName, is, c, genericType, headers,
attachment.getContentType());
} else {
- return new EntityPartImpl(providers, name, null, is, c, genericType, headers,
+ return new EntityPartImpl(mc.getProviders(), name, null, is, c, genericType, headers,
attachment.getContentType());
}
} else {