cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David J. M. Karlsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5675) java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String when adding Location to Response
Date Tue, 08 Apr 2014 19:50:18 GMT

    [ https://issues.apache.org/jira/browse/CXF-5675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13963348#comment-13963348
] 

David J. M. Karlsen commented on CXF-5675:
------------------------------------------

{noformat}

javax.ws.rs.ProcessingException: java.lang.ClassCastException: java.net.URI cannot be cast
to java.lang.String
	at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1174)
	at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1138)
	at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1075)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:869)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:840)
	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:307)
	at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:316)
	at com.davidkarlsen.traxidx.srv.service.blob.BlobServiceTest.postFile(BlobServiceTest.java:61)
	at com.davidkarlsen.traxidx.srv.service.blob.BlobServiceTest.assertInitialAddBlobIs201(BlobServiceTest.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
Caused by: java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String
	at org.apache.cxf.jaxrs.client.AbstractClient.setResponseBuilder(AbstractClient.java:389)
	at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1151)
	... 36 more
{noformat}

I should add that I´m runnning localtransport

> 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
>
> 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)

Mime
View raw message