You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// org.postgresql.Driver#connect from pgdriver:42.4.1Propertiesprops = newProperties(defaults);
if (info != null) {
// notice the line belowSet<String> e = info.stringPropertyNames();
for (StringpropName : e) {
StringpropValue = info.getProperty(propName);
if (propValue == null) {
thrownewPSQLException(
GT.tr("Properties for the driver contains a non-string value for the key ")
+ propName,
PSQLState.UNEXPECTED_ERROR);
}
props.setProperty(propName, propValue);
}
}
同时旧版本的PG驱动上这两个值还会导致NPE, 因为老PG驱动上获取properties时未使用info.stringPropertyNames()而是获取了全部的propertyNames, 同时getProperty如果遇到非String类型返回NULL, 导致下面的props.setProperty(propName, info.getProperty(propName))抛NPE
and it cause the NPE in the old version of PG:
Propertiesprops = newProperties(defaults);
Enumeratione = info.propertyNames();
while(e.hasMoreElements()) {
StringpropName = (String)e.nextElement();
// the line below cause NPE , getProperty traits non-string value as nullprops.setProperty(propName, info.getProperty(propName));
}
新驱动不生效, 老驱动抛异常, 请帮忙看看
The text was updated successfully, but these errors were encountered:
Affected Version
Druid 1.2.12
Description
DruidAbstractDataSource#createPhysicalConnection 添加了 Integer类型的
loginTimeout
andsocketTimeout
但PosgresSQL Driver仅过滤及读取String类型的KV参数, 理论上这两个值是不生效的
同时旧版本的PG驱动上这两个值还会导致NPE, 因为老PG驱动上获取properties时未使用
info.stringPropertyNames()
而是获取了全部的propertyNames
, 同时getProperty
如果遇到非String类型返回NULL, 导致下面的props.setProperty(propName, info.getProperty(propName))
抛NPEand it cause the NPE in the old version of PG:
新驱动不生效, 老驱动抛异常, 请帮忙看看
The text was updated successfully, but these errors were encountered: