[jira] [Commented] (CXF-7640) Create a form to set the use of Spring in the classHelper on a per client way

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CXF-7640:
-

deki commented on issue #387: [CXF-7640] Create a form to set the use of Spring 
in the classHelper …
URL: https://github.com/apache/cxf/pull/387#issuecomment-371408809
 
 
   Don't worry about the Jenkins build, the failure is caused by a flapping 
test not related to your changes.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


>  Create a form to set the use of Spring in the classHelper on a per client way
> --
>
> Key: CXF-7640
> URL: https://issues.apache.org/jira/browse/CXF-7640
> Project: CXF
>  Issue Type: Improvement
>  Components: Core
>Reporter: Osvaldo Pina
>Priority: Major
> Attachments: cxf7640.txt
>
>
> The solution for CXF-6191 allows for configuration of the use of Spring in 
> ClassHelper in a per vm way via System property. Would be nice to have a way 
> to configure it in a per instance way (or, at least, in a per classloader way)
>  
>   
>   
>   
>   
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7666) Binary multipart payload are shown even if logBinary Flag is set to false

2018-03-07 Thread Dennis Kieselhorst (JIRA)

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

Dennis Kieselhorst commented on CXF-7666:
-

Hmm currently the content type is used to check if content should be logged or 
not. Do you have a proposal how to change that? Please take a look at 
[https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java]
 and feel free to submit a PR [https://github.com/apache/cxf/pulls].

> Binary multipart payload are shown even if logBinary Flag is set to false
> -
>
> Key: CXF-7666
> URL: https://issues.apache.org/jira/browse/CXF-7666
> Project: CXF
>  Issue Type: Bug
>  Components: logging
>Affects Versions: 3.2.1
>Reporter: Mohamed Moez MANSOURI
>Priority: Major
>
> **
> Iam using
> {code:java}
>  
>   org.apache.cxf
>   cxf-rt-features-logging
> 3.2.1
>   
> {code}
> And i still have logs of binary parts of a multipart message (image/png) even 
> if the flag "logBinary" of AbstractLoggingInterceptor is false by default.
>  Can you help me ? I would like that if that flag is false , it applies also 
> to the inner parts of a multipart message.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (CXF-7669) Cxf encodes escape caracters twice in JDK9.0.5 and JDK8_161

2018-03-07 Thread Mark Czubin (JIRA)

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

Mark Czubin updated CXF-7669:
-
Description: 
When our response text contains escape characters then those will be encoded 
twice. 

For example when I return "hello > world". Cxf will encode this as "hello &> 
world"
{code:java}
hello  world{code}
 

Below a test with all the interceptors used in our setup on production: 
{code:java}
package be.vlaanderen.omgeving.rest.controller.parameter.v1;

import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.binding.Binding;
import org.apache.cxf.binding.BindingFactory;
import org.apache.cxf.binding.BindingFactoryManager;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.EndpointException;
import org.apache.cxf.endpoint.EndpointImpl;
import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.wsdl.interceptors.BareOutInterceptor;
import org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor;
import org.apache.cxf.wsdl11.WSDLServiceFactory;
import org.junit.Test;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.TreeSet;

import static java.util.Collections.emptyList;
import static 
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.OUT_BUFFERING;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

public class CxfIsUnstable {
CxfFacade cxf = new CxfFacade();

@Test
public void 
givenAResponseWithAmpersans_whenMarshallingToXml_theAmpersandAreEncoded_onlyOnce()
 throws Exception {
cxf.setupExampleService();

String request = cxf.demarshallRequest("hello  
world");
assertThat(request).isEqualTo("hello & world");

String responseXml = cxf.marshallResponse("hello & world");
assertThat(responseXml).isEqualTo("hello  
world<");
}

static class CxfFacade {
private final SAAJOutInterceptor saajOutInterceptor = new 
SAAJOutInterceptor();
private final BareOutInterceptor outInterceptor = new 
BareOutInterceptor();
private final DocLiteralInInterceptor inInterceptor = new 
DocLiteralInInterceptor();
private SoapMessage message;

private List messageContents;

public String demarshallRequest(String input) throws XMLStreamException 
{
message.setContent(XMLStreamReader.class, 
XMLInputFactory.newInstance().createXMLStreamReader(new 
ByteArrayInputStream(input.getBytes(;

StaxUtils.skipToStartOfElement(message.getContent(XMLStreamReader.class));

inInterceptor.handleMessage(message);

assertThat(message.getContent(Exception.class)).isNull();
messageContents = message.getContent(List.class);
String requestContent = (String) messageContents.get(0);

saajOutInterceptor.handleMessage(message);
return requestContent;
}

public String marshallResponse(String responseBody) throws Exception {
messageContents.set(0, responseBody);

ByteArrayOutputStream boas = new ByteArrayOutputStream();
XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
XMLStreamWriter output = 
xmlOutputFactory.createXMLStreamWriter(boas);
message.setContent(XMLStreamWriter.class, output);
message.put(OUT_BUFFERING, "true");
outInterceptor.handleMessage(message);
output.flush();
boas.flush();

return boas.toString();
}

public void setupExampleService() throws JAXBException, 
EndpointException {
Bus bus = BusFactory.newInstance().createBus();
BindingFactoryManager bfm = 
bus.getExtension(BindingFactoryManager.class);
BindingFactory bf = mock(BindingFactory.class);
Binding binding = mock(Binding.class);

given(bf.createBinding(null)).willReturn(binding);
given(binding.getInFaultInterceptors()).willReturn(emptyList());
  

[jira] [Updated] (CXF-7669) Cxf encodes escape caracters twice in JDK9.0.5 and JDK8_161

2018-03-07 Thread Mark Czubin (JIRA)

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

Mark Czubin updated CXF-7669:
-
Description: 
When our response text contains escape characters then those will be encoded 
twice. 

For example when I return "hello > world". Cxf will encode this as "hello 
 world".

Below a test with all the interceptors used in our setup on production: 
{code:java}
package be.vlaanderen.omgeving.rest.controller.parameter.v1;

import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.binding.Binding;
import org.apache.cxf.binding.BindingFactory;
import org.apache.cxf.binding.BindingFactoryManager;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.EndpointException;
import org.apache.cxf.endpoint.EndpointImpl;
import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.wsdl.interceptors.BareOutInterceptor;
import org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor;
import org.apache.cxf.wsdl11.WSDLServiceFactory;
import org.junit.Test;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.TreeSet;

import static java.util.Collections.emptyList;
import static 
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.OUT_BUFFERING;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

public class CxfIsUnstable {
CxfFacade cxf = new CxfFacade();

@Test
public void 
givenAResponseWithAmpersans_whenMarshallingToXml_theAmpersandAreEncoded_onlyOnce()
 throws Exception {
cxf.setupExampleService();

String request = cxf.demarshallRequest("hello  
world");
assertThat(request).isEqualTo("hello & world");

String responseXml = cxf.marshallResponse("hello & world");
assertThat(responseXml).isEqualTo("hello  
world<");
}

static class CxfFacade {
private final SAAJOutInterceptor saajOutInterceptor = new 
SAAJOutInterceptor();
private final BareOutInterceptor outInterceptor = new 
BareOutInterceptor();
private final DocLiteralInInterceptor inInterceptor = new 
DocLiteralInInterceptor();
private SoapMessage message;

private List messageContents;

public String demarshallRequest(String input) throws XMLStreamException 
{
message.setContent(XMLStreamReader.class, 
XMLInputFactory.newInstance().createXMLStreamReader(new 
ByteArrayInputStream(input.getBytes(;

StaxUtils.skipToStartOfElement(message.getContent(XMLStreamReader.class));

inInterceptor.handleMessage(message);

assertThat(message.getContent(Exception.class)).isNull();
messageContents = message.getContent(List.class);
String requestContent = (String) messageContents.get(0);

saajOutInterceptor.handleMessage(message);
return requestContent;
}

public String marshallResponse(String responseBody) throws Exception {
messageContents.set(0, responseBody);

ByteArrayOutputStream boas = new ByteArrayOutputStream();
XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
XMLStreamWriter output = 
xmlOutputFactory.createXMLStreamWriter(boas);
message.setContent(XMLStreamWriter.class, output);
message.put(OUT_BUFFERING, "true");
outInterceptor.handleMessage(message);
output.flush();
boas.flush();

return boas.toString();
}

public void setupExampleService() throws JAXBException, 
EndpointException {
Bus bus = BusFactory.newInstance().createBus();
BindingFactoryManager bfm = 
bus.getExtension(BindingFactoryManager.class);
BindingFactory bf = mock(BindingFactory.class);
Binding binding = mock(Binding.class);

given(bf.createBinding(null)).willReturn(binding);
given(binding.getInFaultInterceptors()).willReturn(emptyList());

[jira] [Resolved] (CXF-7671) should avoid reverse dns resolution in AsyncHTTPConduit for the proxy host address

2018-03-07 Thread Freeman Fang (JIRA)

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

Freeman Fang resolved CXF-7671.
---
   Resolution: Fixed
Fix Version/s: 3.2.3

> should avoid reverse dns resolution in AsyncHTTPConduit for the proxy host 
> address
> --
>
> Key: CXF-7671
> URL: https://issues.apache.org/jira/browse/CXF-7671
> Project: CXF
>  Issue Type: Improvement
>Reporter: Freeman Fang
>Assignee: Freeman Fang
>Priority: Major
> Fix For: 3.2.3
>
>
> currently it use
> {code}
> HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
> {code}
> and InetSocketAddress.getHostName will trigger dns reserve resolution when 
> the proxy address is literal ip
> {code}
> /**
>  * Gets the {@code hostname}.
>  * Note: This method may trigger a name service reverse lookup if the
>  * address was created with a literal IP address.
>  *
>  * @return  the hostname part of the address.
>  */
> {code}
> This dns reserve resolution is time-consuming and should be avoid, as the 
> proxy is specified by users, they can specify as hostname or literal ip per 
> their requirement.
> We should use InetSocketAddress.getHostString instead,  this will return what 
> users has specified as is
> {code}
> /**
>  * Returns the hostname, or the String form of the address if it
>  * doesn't have a hostname (it was created using a literal).
>  * This has the benefit of not attempting a reverse lookup.
>  *
>  * @return the hostname, or String representation of the address.
>  * @since 1.7
>  */
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CXF-7671) should avoid reverse dns resolution in AsyncHTTPConduit for the proxy host address

2018-03-07 Thread Freeman Fang (JIRA)
Freeman Fang created CXF-7671:
-

 Summary: should avoid reverse dns resolution in AsyncHTTPConduit 
for the proxy host address
 Key: CXF-7671
 URL: https://issues.apache.org/jira/browse/CXF-7671
 Project: CXF
  Issue Type: Improvement
Reporter: Freeman Fang


currently it use
{code}
HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
{code}
and InetSocketAddress.getHostName will trigger dns reserve resolution when the 
proxy address is literal ip
{code}
/**
 * Gets the {@code hostname}.
 * Note: This method may trigger a name service reverse lookup if the
 * address was created with a literal IP address.
 *
 * @return  the hostname part of the address.
 */
{code}
This dns reserve resolution is time-consuming and should be avoid, as the proxy 
is specified by users, they can specify as hostname or literal ip per their 
requirement.

We should use InetSocketAddress.getHostString instead,  this will return what 
users has specified as is
{code}
/**
 * Returns the hostname, or the String form of the address if it
 * doesn't have a hostname (it was created using a literal).
 * This has the benefit of not attempting a reverse lookup.
 *
 * @return the hostname, or String representation of the address.
 * @since 1.7
 */
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Assigned] (CXF-7671) should avoid reverse dns resolution in AsyncHTTPConduit for the proxy host address

2018-03-07 Thread Freeman Fang (JIRA)

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

Freeman Fang reassigned CXF-7671:
-

Assignee: Freeman Fang

> should avoid reverse dns resolution in AsyncHTTPConduit for the proxy host 
> address
> --
>
> Key: CXF-7671
> URL: https://issues.apache.org/jira/browse/CXF-7671
> Project: CXF
>  Issue Type: Improvement
>Reporter: Freeman Fang
>Assignee: Freeman Fang
>Priority: Major
>
> currently it use
> {code}
> HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
> {code}
> and InetSocketAddress.getHostName will trigger dns reserve resolution when 
> the proxy address is literal ip
> {code}
> /**
>  * Gets the {@code hostname}.
>  * Note: This method may trigger a name service reverse lookup if the
>  * address was created with a literal IP address.
>  *
>  * @return  the hostname part of the address.
>  */
> {code}
> This dns reserve resolution is time-consuming and should be avoid, as the 
> proxy is specified by users, they can specify as hostname or literal ip per 
> their requirement.
> We should use InetSocketAddress.getHostString instead,  this will return what 
> users has specified as is
> {code}
> /**
>  * Returns the hostname, or the String form of the address if it
>  * doesn't have a hostname (it was created using a literal).
>  * This has the benefit of not attempting a reverse lookup.
>  *
>  * @return the hostname, or String representation of the address.
>  * @since 1.7
>  */
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7670) synthetic methods: equal candidates for handling the current request

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CXF-7670:
-

K0zka opened a new pull request #388: [CXF-7670] create a single 
ClassResourceInfo per class + annotated method
URL: https://github.com/apache/cxf/pull/388
 
 
   In each resource class, an annotated method should be registered only once.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> synthetic methods: equal candidates for handling the current request
> 
>
> Key: CXF-7670
> URL: https://issues.apache.org/jira/browse/CXF-7670
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.2.1, 3.2.2
> Environment: I have noticed this with kotlin projects.
>Reporter: Laszlo Hornyak
>Priority: Major
>
> When discovering JAX-RS annotations, CXF does not filter out synthetic 
> methods. If the compiler have created any synthetic methods out of the 
> annotated methods, it will store them as JAX-RS resource methods with 
> actually the same annotated method.
> After startup, CXF will log each invocation on the duplicated resource 
> methods with a warning, which reduces performance, and generates quite some 
> log.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CXF-7670) synthetic methods: equal candidates for handling the current request

2018-03-07 Thread Laszlo Hornyak (JIRA)
Laszlo Hornyak created CXF-7670:
---

 Summary: synthetic methods: equal candidates for handling the 
current request
 Key: CXF-7670
 URL: https://issues.apache.org/jira/browse/CXF-7670
 Project: CXF
  Issue Type: Bug
  Components: JAX-RS
Affects Versions: 3.2.2, 3.2.1
 Environment: I have noticed this with kotlin projects.
Reporter: Laszlo Hornyak


When discovering JAX-RS annotations, CXF does not filter out synthetic methods. 
If the compiler have created any synthetic methods out of the annotated 
methods, it will store them as JAX-RS resource methods with actually the same 
annotated method.

After startup, CXF will log each invocation on the duplicated resource methods 
with a warning, which reduces performance, and generates quite some log.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7640) Create a form to set the use of Spring in the classHelper on a per client way

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CXF-7640:
-

osvaldopina commented on issue #387: [CXF-7640] Create a form to set the use of 
Spring in the classHelper …
URL: https://github.com/apache/cxf/pull/387#issuecomment-371256394
 
 
   The build was successful in my machine. My config is:
   
   - Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 
2017-10-18T05:58:13-02:00)
   
   - Java version: 1.8.0_72, vendor: Oracle Corporation
   
   - OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
   
   What is the jenkins build environment so I can try to reproduce it locally 
and fix the build problem?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


>  Create a form to set the use of Spring in the classHelper on a per client way
> --
>
> Key: CXF-7640
> URL: https://issues.apache.org/jira/browse/CXF-7640
> Project: CXF
>  Issue Type: Improvement
>  Components: Core
>Reporter: Osvaldo Pina
>Priority: Major
> Attachments: cxf7640.txt
>
>
> The solution for CXF-6191 allows for configuration of the use of Spring in 
> ClassHelper in a per vm way via System property. Would be nice to have a way 
> to configure it in a per instance way (or, at least, in a per classloader way)
>  
>   
>   
>   
>   
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CXF-7669) Cxf encodes escape caracters twice in JDK9.0.5 and JDK8_161

2018-03-07 Thread Mark Czubin (JIRA)
Mark Czubin created CXF-7669:


 Summary: Cxf encodes escape caracters twice in JDK9.0.5 and 
JDK8_161
 Key: CXF-7669
 URL: https://issues.apache.org/jira/browse/CXF-7669
 Project: CXF
  Issue Type: Bug
Affects Versions: 3.2.2
Reporter: Mark Czubin
 Attachments: ExampleService.wsdl

When our response text contains escape characters then those will be encoded 
twice. 

For example when I return "hello > world". Cxf will encode this as "hello 
gt; world".

Below a test with all the interceptors used in our setup on production: 
{code:java}
package be.vlaanderen.omgeving.rest.controller.parameter.v1;

import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.binding.Binding;
import org.apache.cxf.binding.BindingFactory;
import org.apache.cxf.binding.BindingFactoryManager;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.EndpointException;
import org.apache.cxf.endpoint.EndpointImpl;
import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.wsdl.interceptors.BareOutInterceptor;
import org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor;
import org.apache.cxf.wsdl11.WSDLServiceFactory;
import org.junit.Test;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.TreeSet;

import static java.util.Collections.emptyList;
import static 
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.OUT_BUFFERING;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

public class CxfIsUnstable {
CxfFacade cxf = new CxfFacade();

@Test
public void 
givenAResponseWithAmpersans_whenMarshallingToXml_theAmpersandAreEncoded_onlyOnce()
 throws Exception {
cxf.setupExampleService();

String request = cxf.demarshallRequest("hello  
world");
assertThat(request).isEqualTo("hello & world");

String responseXml = cxf.marshallResponse("hello & world");
assertThat(responseXml).isEqualTo("hello  
world<");
}

static class CxfFacade {
private final SAAJOutInterceptor saajOutInterceptor = new 
SAAJOutInterceptor();
private final BareOutInterceptor outInterceptor = new 
BareOutInterceptor();
private final DocLiteralInInterceptor inInterceptor = new 
DocLiteralInInterceptor();
private SoapMessage message;

private List messageContents;

public String demarshallRequest(String input) throws XMLStreamException 
{
message.setContent(XMLStreamReader.class, 
XMLInputFactory.newInstance().createXMLStreamReader(new 
ByteArrayInputStream(input.getBytes(;

StaxUtils.skipToStartOfElement(message.getContent(XMLStreamReader.class));

inInterceptor.handleMessage(message);

assertThat(message.getContent(Exception.class)).isNull();
messageContents = message.getContent(List.class);
String requestContent = (String) messageContents.get(0);

saajOutInterceptor.handleMessage(message);
return requestContent;
}

public String marshallResponse(String responseBody) throws Exception {
messageContents.set(0, responseBody);

ByteArrayOutputStream boas = new ByteArrayOutputStream();
XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
XMLStreamWriter output = 
xmlOutputFactory.createXMLStreamWriter(boas);
message.setContent(XMLStreamWriter.class, output);
message.put(OUT_BUFFERING, "true");
outInterceptor.handleMessage(message);
output.flush();
boas.flush();

return boas.toString();
}

public void setupExampleService() throws JAXBException, 
EndpointException {
Bus bus = BusFactory.newInstance().createBus();
BindingFactoryManager bfm = 
bus.getExtension(BindingFactoryManager.class);
BindingFactory bf = mock(BindingFactory.class);
Binding binding = 

[jira] [Commented] (CXF-7640) Create a form to set the use of Spring in the classHelper on a per client way

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CXF-7640:
-

osvaldopina opened a new pull request #387: [CXF-7640] Create a form to set the 
use of Spring in the classHelper …
URL: https://github.com/apache/cxf/pull/387
 
 
   …on a per client way


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


>  Create a form to set the use of Spring in the classHelper on a per client way
> --
>
> Key: CXF-7640
> URL: https://issues.apache.org/jira/browse/CXF-7640
> Project: CXF
>  Issue Type: Improvement
>  Components: Core
>Reporter: Osvaldo Pina
>Priority: Major
> Attachments: cxf7640.txt
>
>
> The solution for CXF-6191 allows for configuration of the use of Spring in 
> ClassHelper in a per vm way via System property. Would be nice to have a way 
> to configure it in a per instance way (or, at least, in a per classloader way)
>  
>   
>   
>   
>   
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7666) Binary multipart payload are shown even if logBinary Flag is set to false

2018-03-07 Thread Mohamed Moez MANSOURI (JIRA)

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

Mohamed Moez MANSOURI commented on CXF-7666:


Hello Dennis, thank you for your answer, but putting logMultipart flag to 
"false" is  not really what i want since it will make the multipart messages 
not logged at all. What i want is to not log the binary part of a multipart 
message.

> Binary multipart payload are shown even if logBinary Flag is set to false
> -
>
> Key: CXF-7666
> URL: https://issues.apache.org/jira/browse/CXF-7666
> Project: CXF
>  Issue Type: Bug
>  Components: logging
>Affects Versions: 3.2.1
>Reporter: Mohamed Moez MANSOURI
>Priority: Major
>
> **
> Iam using
> {code:java}
>  
>   org.apache.cxf
>   cxf-rt-features-logging
> 3.2.1
>   
> {code}
> And i still have logs of binary parts of a multipart message (image/png) even 
> if the flag "logBinary" of AbstractLoggingInterceptor is false by default.
>  Can you help me ? I would like that if that flag is false , it applies also 
> to the inner parts of a multipart message.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CXF-6030) javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set for cxf.

2018-03-07 Thread harsh shah (JIRA)

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

harsh shah edited comment on CXF-6030 at 3/7/18 11:13 AM:
--

[~dkulp] can you please help me with how to get rid of this error ? Just by 
upgrading jar or something else? I can not find information from comments.

 Also I am using following version of cxf.

3.1.5
 3.1.5

 

Please help.


was (Author: harshshah):
[~dkulp] can you please help me with how to get rid of this error ? Just by 
upgrading jar or something else? I can not find information from comments.

 

Please help.

> javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, 
> not set for cxf.
> -
>
> Key: CXF-6030
> URL: https://issues.apache.org/jira/browse/CXF-6030
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-WS Runtime
>Reporter: Jagat
>Assignee: Daniel Kulp
>Priority: Major
> Fix For: 3.0.3, 2.7.14
>
>
> Hi, 
> I am getting following error for my application on PROD:
> [Tue, 30-Sep-2014 @ 12:22:14.469] [catalina-exec-86] ERROR 
> com.dish.dishapi.service.Service  - InvocationTargetException occured while 
> calling operation: getOAuthAuthentication with error message: 
> java.lang.reflect.InvocationTargetException
>   at com.dish.dishapi.service.Service.invokeOperation(Service.java:37)
>   at 
> com.dish.dishapi.service.ResourceEntitlementService.execute(ResourceEntitlementService.java:16)
>   at 
> com.dish.api.service.ResourceEntitlementServiceEntry.execute(ResourceEntitlementServiceEntry.groovy:11)
>   at com.dish.api.AuthController.oAuth(AuthController.groovy:56)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>   at java.lang.Thread.run(Thread.java:744)
> Caused by: javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly 
> fault code, not set
>   at 
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:157)
>   at 
> com.dish.dishapi.service.resourceentitlement.ResourceEntitlementV5.getOAuthAuthentication(ResourceEntitlementV5.java:109)
>   ... 7 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:43)
>   at 
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
>   at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
>   at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
>   at 
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
>   ... 8 more
>  Its not happening on my Local. Also its not happening on PROD all time.. But 
> when it started it is happening all the time on that specific cluster.
> Codebase:
> Service Client Class
> public class ResourceEntitlementV5 {
> private static ResourceEntitlementV50PortType resourceEntitlementPortV5 = 
> (ResourceEntitlementV50PortType) DishApiPortFactory.RESOURCE_ENTITLEMENT_MGMT
> .create();
> public ProcessAuthenticationResponse processAuthentication(
> ResourceEntitlementTransferRequest request) {
> return resourceEntitlementPortV5.processAuthentication(request);
> }
> Configuration of port calls:
> public class DishApiPortFactory {
> public static final DishApiPortFactory 
> RESOURCE_ENTITLEMENT_MGMT = newPortFactory(
> new ResourceEntitlementV50().getResourceEntitlementV50Port(),
> UriMapper.RESOURCE_ENTITLEMENT_MGMT_ENDPOINT);
>  private static  DishApiPortFactory newPortFactory(T port, String 
> endpointPropName) {
> log.info(" Starting STUB and ENDPOINT binding  for end point key :{} 
> ", endpointPropName);
> String uri = null;
> try {
>
> uri = 
> DishApiKeyValueUtility.getValueFromKey(endpointPropName);
> log.info(" FOUND URI for {} = {} ", endpointPropName, uri);
> Map requestContext = ((BindingProvider) 
> port).getRequestContext();
> log.info("URI: " + uri);
> requestContext.put("thread.local.request.context", "true");
> 

[jira] [Commented] (CXF-6030) javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set for cxf.

2018-03-07 Thread harsh shah (JIRA)

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

harsh shah commented on CXF-6030:
-

[~dkulp] can you please help me with how to get rid of this error ? Just by 
upgrading jar or something else? I can not find information from comments.

 

Please help.

> javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, 
> not set for cxf.
> -
>
> Key: CXF-6030
> URL: https://issues.apache.org/jira/browse/CXF-6030
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-WS Runtime
>Reporter: Jagat
>Assignee: Daniel Kulp
>Priority: Major
> Fix For: 3.0.3, 2.7.14
>
>
> Hi, 
> I am getting following error for my application on PROD:
> [Tue, 30-Sep-2014 @ 12:22:14.469] [catalina-exec-86] ERROR 
> com.dish.dishapi.service.Service  - InvocationTargetException occured while 
> calling operation: getOAuthAuthentication with error message: 
> java.lang.reflect.InvocationTargetException
>   at com.dish.dishapi.service.Service.invokeOperation(Service.java:37)
>   at 
> com.dish.dishapi.service.ResourceEntitlementService.execute(ResourceEntitlementService.java:16)
>   at 
> com.dish.api.service.ResourceEntitlementServiceEntry.execute(ResourceEntitlementServiceEntry.groovy:11)
>   at com.dish.api.AuthController.oAuth(AuthController.groovy:56)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>   at java.lang.Thread.run(Thread.java:744)
> Caused by: javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly 
> fault code, not set
>   at 
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:157)
>   at 
> com.dish.dishapi.service.resourceentitlement.ResourceEntitlementV5.getOAuthAuthentication(ResourceEntitlementV5.java:109)
>   ... 7 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:43)
>   at 
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
>   at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
>   at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
>   at 
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
>   ... 8 more
>  Its not happening on my Local. Also its not happening on PROD all time.. But 
> when it started it is happening all the time on that specific cluster.
> Codebase:
> Service Client Class
> public class ResourceEntitlementV5 {
> private static ResourceEntitlementV50PortType resourceEntitlementPortV5 = 
> (ResourceEntitlementV50PortType) DishApiPortFactory.RESOURCE_ENTITLEMENT_MGMT
> .create();
> public ProcessAuthenticationResponse processAuthentication(
> ResourceEntitlementTransferRequest request) {
> return resourceEntitlementPortV5.processAuthentication(request);
> }
> Configuration of port calls:
> public class DishApiPortFactory {
> public static final DishApiPortFactory 
> RESOURCE_ENTITLEMENT_MGMT = newPortFactory(
> new ResourceEntitlementV50().getResourceEntitlementV50Port(),
> UriMapper.RESOURCE_ENTITLEMENT_MGMT_ENDPOINT);
>  private static  DishApiPortFactory newPortFactory(T port, String 
> endpointPropName) {
> log.info(" Starting STUB and ENDPOINT binding  for end point key :{} 
> ", endpointPropName);
> String uri = null;
> try {
>
> uri = 
> DishApiKeyValueUtility.getValueFromKey(endpointPropName);
> log.info(" FOUND URI for {} = {} ", endpointPropName, uri);
> Map requestContext = ((BindingProvider) 
> port).getRequestContext();
> log.info("URI: " + uri);
> requestContext.put("thread.local.request.context", "true");
> requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
> uri);
> } catch (Exception e) {
> log.error("Exception thrown while doing STUB and ENDPOINT 
> binding", e);
> }
> return new DishApiPortFactory(port);
> }
> cxf version: cxf-codegen-plugin-2.7.11



--
This message was sent by Atlassian JIRA