While trying to use jt400 (https://jt400.sourceforge.net/) in order to connect a quarkus native application to an IBM-i machine, I would run to the following problem while setting the password: "WARN [io.agr.pool] (main) Datasource 'as400xa': Ignoring property 'Password': Can't convert to [C"
Going through their code (jt400's code), I see that they have two setters for the password property in the data source implementation:
- a deprecated setPassword(String password)
- a (newly introduced) setPassword(char[] password)
First of all the PropertyInjector has the assumption (which seems reasonable to me ) that every property will have exactly one setter method and builds a map of property names to Method instances. However it seems that in this case, it is kind of non-deterministic which of the two setters will get added to this map. Sometimes, I would get the error (which would mean that the char[] parameter method was added to the map) and sometimes not (which would mean that the String parameter method was added to the map).
Ignoring the minor inconvenience above, the real problem I think is that the PropertyInjector::typeConvert() method cannot deal with a char[] target. Such a Class object falls through the if/elseif set of statements to the end and throws an IllegalArgumentException. I think it is an easy fix to make the typeConvert() method handle this case also.