Repository: cxf Updated Branches: refs/heads/3.0.x-fixes aba8623f5 -> 91a0cf895
[CXF-7075] Applying JAXRSUtils update from Andy McCright with minor modifications Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/91a0cf89 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/91a0cf89 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/91a0cf89 Branch: refs/heads/3.0.x-fixes Commit: 91a0cf8952b515e5bd0d1ad1880b8851fb48c8a0 Parents: aba8623 Author: Sergey Beryozkin <sberyoz...@gmail.com> Authored: Wed Oct 12 14:28:54 2016 +0100 Committer: Sergey Beryozkin <sberyoz...@gmail.com> Committed: Wed Oct 12 14:31:18 2016 +0100 ---------------------------------------------------------------------- .../org/apache/cxf/jaxrs/utils/JAXRSUtils.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/91a0cf89/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java index dea445e..41c12f6 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java @@ -1413,16 +1413,16 @@ public final class JAXRSUtils { List<MediaType> acceptValues = new ArrayList<MediaType>(); if (types != null) { - while (types.length() > 0) { - String tp = types; - int index = types.indexOf(','); - if (index != -1) { - tp = types.substring(0, index); - types = types.substring(index + 1).trim(); - } else { - types = ""; - } - acceptValues.add(toMediaType(tp)); + int x = 0; + int y = types.indexOf(','); + while (y > 0) { + acceptValues.add(toMediaType(types.substring(x, y).trim())); + x = y + 1; + y = types.indexOf(',', x); + } + String lastMediaType = types.substring(x).trim(); + if (!lastMediaType.isEmpty()) { + acceptValues.add(toMediaType(lastMediaType)); } } else { acceptValues.add(ALL_TYPES);