btm icon indicating copy to clipboard operation
btm copied to clipboard

XAFactories which implement java.util.Map (MQXAConnectionFactory) cannot be initialized properly

Open tomasjura opened this issue 6 years ago • 3 comments

XAFactories which implements java.util.Map (for example com.ibm.mq.jms.MQXAConnectionFactory), cannot be initialized correctly by .properties configuration. Problem is in the function bitronix.tm.utils.PropertyUtils.setProperty where is

if (currentTarget instanceof Map) { ... }
else { setDirectProperty( ... ) }.

The priority should be IMHO inverse. i.e.

if the property exists then { setDirectProperty(...) } 
else {
  if XAFactory is a map then {
      setup map and log warning about setting value in the Map.
  }
}

tomasjura avatar Jun 25 '19 13:06 tomasjura

Thanks for the report. How about you create a PR with a test and a fix?

lorban avatar Jun 26 '19 10:06 lorban

I'm working on the fix. Would be nice to have a confirmation that the proposed logic change ( the named property first, maps as the second ) is correct and do not clash with some another processes. As the first attempt I changed the XAFactoryHelper.java to use the setDirectProperty instead setProperty, but test testBindOneJdbc fails with NPE.

tomasjura avatar Jun 27 '19 09:06 tomasjura

Well, your proposed logic seems reasonable at first look. I unfortunately couldn't tell you if there would be some undesired side-effect out of what the unit test would catch as I haven't worked on it in years.

Please be aware that while I would happily merge your PR, I do not have the means anymore to perform a release to maven central.

lorban avatar Jun 27 '19 11:06 lorban