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

Dirk Fiedler edited comment on CAMEL-21197 at 9/11/24 9:33 AM:
---------------------------------------------------------------

Hi Claus,

we are using the Apache Camel LRA within a Java SpringBoot project.

Until last week, we are using Narayana as an LRA Coordinator .. now we try 
to switch to Oracle MicroTX.

We found two problems.

This one occurs while 'org.apache.camel.service.lra.LRASagaRoutes' is verifying 
the incomming request from the LRA Coordinator. The call is URL encoded from 
Oracle:
{code:java}
PUT 
/camel/complete?Camel-Saga-Complete=direct%3A%2F%2Fsaga1_sagaService_complete 
HTTP/1.1Host{code}
Within LRASagaService the util is used:
{code:java}
URISupport.parseQuery(exchange.getIn().getHeader(Exchange.HTTP_QUERY, 
String.class)); {code}
The LRA code expects / needs the decoded value, but get the encoded one from 
the Util.

For the second problem i am preparing a solution .. will create a Jira ticket 
and will try to contribute ..

Before i do this, i want to be sure, that i understood this util correct ..

best regards

Dirk


was (Author: JIRAUSER306992):
Hi Claus,

we are using the Apache Camel LRA within a Java SpringBoot project.

Until last week, we are using Narayana as an LRA Coordinator .. now we try 
to switch to Oracle MicroTX. 

We found two problems.

This one occurs while 'org.apache.camel.service.lra.LRASagaService' is 
verifying 
the incomming request from the LRA Coordinator. The call is URL encoded from 
Oracle:


{code:java}
PUT 
/camel/complete?Camel-Saga-Complete=direct%3A%2F%2Fsaga1_sagaService_complete 
HTTP/1.1Host{code}
Within LRASagaService the util is used:


{code:java}
URISupport.parseQuery(exchange.getIn().getHeader(Exchange.HTTP_QUERY, 
String.class)); {code}

The LRA code expects / needs the decoded value, but get the encoded one from 
the Util.

For the second problem i am preparing a solution .. will create a Jira ticket 
and will try to contribute ..

Before i do this, i want to be sure, that i understood this util correct ..

best regards

Dirk

> URISupport.parseQuery is not decoding correctly
> -----------------------------------------------
>
>                 Key: CAMEL-21197
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21197
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 4.7.0
>            Reporter: Dirk Fiedler
>            Priority: Minor
>
> {color:#000000}Hi team,{color}
> {color:#000000}while using *URISupport.parseQuery* the given query was not 
> correctly decoded:{color}
> *{color:#000000}Sample JUnit test 
> (org.apache.camel.util.URISupportTest):{color}*
>  
> {code:java}
> @Test
> public void testParseQueryDFi() throws Exception {
>     Map<String, Object> map = 
> URISupport.parseQuery("Camel-Saga-Complete=direct%3A%2F%2Fsaga1_sagaService_complete");
>     assertEquals(1, map.size());
>     assertEquals("direct://saga1_sagaService_complete", 
> map.get("Camel-Saga-Complete"));
> } {code}
> {color:#000000}If i handover the query 
> 'Camel-Saga-Complete=direct%3A%2F%2Fsaga1_sagaService_complete' 
> i expect the decoded value {color}{color:#000000}for 'Camel-Saga-Complete' as 
> 'direct://saga1_sagaService_complete'.{color}
> {color:#000000}I am wrong? Did i understand the utility class wrong?{color}
> {color:#000000}Within the code i can see, that the string was adjusted to 
> replace '%', this is {color}
> {color:#000000}causing the issue:{color}
> *{color:#000000}URIScanner.addParameter:{color}*
>  
> {code:java}
> if (isRaw) {
>     text = value.toString();
> } else {
>     // need to replace % with %25 to avoid losing "%" when decoding
>     final String s = replacePercent(value.toString());    
>     text = URLDecoder.decode(s, CHARSET);
> }{code}
>  
> {color:#000000}best regards{color}
> {color:#000000}Dirk{color}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to