[jboss-jira] [JBoss JIRA] (JBJCA-1380) XAManagedConnectionFactory screws up Datasource urls containing ;

Yannick Einsweiler (Jira) issues at jboss.org
Thu Nov 29 10:24:01 EST 2018


    [ https://issues.jboss.org/browse/JBJCA-1380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13666136#comment-13666136 ] 

Yannick Einsweiler edited comment on JBJCA-1380 at 11/29/18 10:23 AM:
----------------------------------------------------------------------

[~chrispoulsen] same here. 
Not sure why semicolon was replaced in the first place but you cannot just comment out that line as the User and Password properties are concatenated to it using semicolon.

As such you must only replace for those properties which have a setter in _org.h2.jdbcx.JdbcDataSource_, that is, User, Password and URL. Replace the offending line with:
{code:java}
xaDataSourceProperties = xaDataSourceProperties.replaceAll('(?i);(user|password|url)', '\n$1');
{code}



was (Author: einsweiy):
[~chrispoulsen] same here. Not sure why semicolon was replaced in the first place but you cannot just comment out that line as the User and Password properties are concatenated to it using semicolon.
As such you must only replace for those properties which have a setter in {quote}org.h2.jdbcx.JdbcDataSource{quote}, that is, User, Password and URL. Replace the offending line with:

{code:java}
xaDataSourceProperties = xaDataSourceProperties.replaceAll('(?i);(user|password|url)', '\n$1');
{code}


> XAManagedConnectionFactory screws up Datasource urls containing ;
> -----------------------------------------------------------------
>
>                 Key: JBJCA-1380
>                 URL: https://issues.jboss.org/browse/JBJCA-1380
>             Project: IronJacamar
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 1.4.9
>         Environment: Unit testing using an embedded ironjacamar
>            Reporter: Chris Poulsen
>            Priority: Major
>         Attachments: XAManagedConnectionFactory-h2-error.txt
>
>
> While trying to adjust settings on the H2 data source we use for a corner of our system during testing, I ran into problems.
> H2 accepts parameters appended to the url on the form ";<name>=<value>" for example:
> "jdbc:h2:mem:unit-test;MODE=Oracle"
> I was unable to deploy the datasource using:
> <xa-datasource-property name="url">jdbc:h2:mem:unit-test;MODE=Oracle</xa-datasource-property>
> Ironjacamar keeps complaining about: 
> Caused by: java.lang.NoSuchMethodException: Method setMODE not found some setter not being found.
> My initial thought was that <url-delimiter> was the cause, but no dice.
> Following the trace into the sources, I guess the offending line is:
> {code:java}
> xaDataSourceProperties = xaDataSourceProperties.replace(';', '\n');
> {code}
> In XAManagedConnectionFactory around line: 174 (see following snippet)
> {code:java}
>    public void setXADataSourceProperties(String xaDataSourceProperties) throws ResourceException
>    {
>       this.xaDataSourceProperties = xaDataSourceProperties;
>       xaProps.clear();
>       if (xaDataSourceProperties != null)
>       {
>          // Map any \ to \\
>          xaDataSourceProperties = xaDataSourceProperties.replaceAll("\\\\", "\\\\\\\\");
>          // Map any ; to \n
>          xaDataSourceProperties = xaDataSourceProperties.replace(';', '\n');
>          InputStream is = new ByteArrayInputStream(xaDataSourceProperties.getBytes());
>          try
>          {
>             Properties p = new Properties();
>             p.load(is);
>             for (Map.Entry<Object, Object> entry : p.entrySet())
>             {
>                xaProps.put((String)entry.getKey(), (String)entry.getValue());
>             }
>          }
> {code}



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list