You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2014/04/11 18:20:21 UTC

[jira] [Resolved] (CXF-5675) java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String when adding Location to Response

     [ https://issues.apache.org/jira/browse/CXF-5675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-5675.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0.0
         Assignee: Sergey Beryozkin

Fixing for 3.0.0 only giving the sensitivity of the changes in 2.7.x and the fact it affects a test path with Local transport only

> java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String when adding Location to Response
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-5675
>                 URL: https://issues.apache.org/jira/browse/CXF-5675
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.0-milestone2
>            Reporter: David J. M. Karlsen
>            Assignee: Sergey Beryozkin
>             Fix For: 3.0.0
>
>
> Exception:
> java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String
> Test:
> {code}
>  Response response = getWebClient()
>                 .path("/blob")
>                 .type(MediaType.MULTIPART_FORM_DATA)
>                 .post(multipartBody);
> {code}
> serverside resource:
> {code}
>         URI blobId = UriBuilder.fromResource(getClass()).build(gridFSDBFile.getId());
>         return Response.created(blobId).build();
> {code}
> because inside WebClient handleResponse -> AbstractClient the values are assumed to be string arrays, but is an URI object:
> {code}
>  boolean splitHeaders = 
>             MessageUtils.isTrue(outMessage.getContextualProperty(HEADER_SPLIT_PROPERTY));
>         for (Map.Entry<String, List<String>> entry : protocolHeaders.entrySet()) {
>             if (null == entry.getKey()) {
>                 continue;
>             }
>             if (entry.getValue().size() > 0) {
>                 if (HttpUtils.isDateRelatedHeader(entry.getKey())) {
>                     currentResponseBuilder.header(entry.getKey(), entry.getValue().get(0));
>                     continue;                    
>                 }
>                 for (String val : entry.getValue()) {
>                     if (splitHeaders) {
>                         String[] values;
>                         if (val == null || val.length() == 0) {
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)