Hi M.K. Sorry, I missed your PR,
I added an URL unit test as well: https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-jtds/src/test/java/org/ops4j/pax/jdbc/jtds/impl/JTDSDataSourceFactoryTest.java#L110 Of course if you have more things to test, I'm happy to merge any additional PRs. About the ordering - you're right. As the properties are Hashtable backed the number of entries might make a difference in the ordering. Not sure though, why even when using the exact same amount of properties I have in my software and even the exact same URL I couldn't get the unit test to pass, while on my test system with Karaf it just works. Anyway - thanks for finding it! Greetings -Sascha- Am 22.02.2017 um 21:00 schrieb M.K.: > > Hi Sascha, > > I actually created a pull request then figured out that you merged your > change. I have 1 conflicted file now. My change also includes additional > unit testing using a JDBC URL and also integration testing which I can > still merge. > > To your last comment about the 'order' of the properties. Before your > last fix, your logic used to lead to a map with a 'PASSWORD' entry > coming from the URL parsing and a 'password' entry coming from the > 'password' property. When you loop on the map to apply the properties, > all depends on when the loop picks up the 'PASSWORD' entry or the > 'password' entry first. > > On Sunday, 19 February 2017 12:33:12 UTC-5, M.K. wrote: > > Class JTDSDataSourceFactory > > <https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-jtds/src/main/java/org/ops4j/pax/jdbc/jtds/impl/JTDSDataSourceFactory.java>doesn't > work properly when lowercase entries are used in the configuration > and I think this is a defect. I'm using version 1.0.0 but I > double-checked that the most recent code in the repository didn't > solve this problem. > > The class initially builds a connection property map based on the > jdbc URL provided in the configuration (line 76). Properties not > included in the URL are still populated in the map with empty values > and map keys in uppercase. For example 'PASSWORD='. > > The configuration properties are then parsed and the related > key/pair's are added to the map without being uppercase'd, leading > to double entries in the map for each properties: one in lowercase > and one in uppercase (loop at line 77). > > The properties are then injected in the data source object (loop at > line 80). Java reflection is being used for this step and it's using > a case-insensitive logic to select the setter method to be used for > injecting the property into the data source object (line 113). The > uppercase and lowercase entries are ultimately overriding each other. > > This can be reproduced with a configuration like this: > > > url=jdbc:jtds:sqlserver://my.server:1433/my-database;integratedSecurity=true;domain=my-domain;useNTLMv2=true > user=someuser > password=some-password > > As I workaround, I had to uppercase my property keys and this works > fine: > > USER=someuser > PASSWORD=some-password > > Regards > -- -- ------------------ OPS4J - http://www.ops4j.org - [email protected] --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
