MyBatis version
3.5.3
Database vendor and version
Test case or example project
version 3.5.3 has adopted lambda expression, it must be >= JDK 8.
Steps to reproduce
Expected result
// org.apache.ibatis.mapping.VendorDatabaseIdProvider private String getDatabaseProductName(DataSource dataSource) throws SQLException {
try (Connection con = dataSource.getConnection();) {
DatabaseMetaData metaData = con.getMetaData();
return metaData.getDatabaseProductName();
} catch (SQLException e) {
// ignored
}
return null; // or throws exception
}
Actual result
private String getDatabaseProductName(DataSource dataSource) throws SQLException { Connection con = null; try { con = dataSource.getConnection(); DatabaseMetaData metaData = con.getMetaData(); return metaData.getDatabaseProductName(); } finally { if (con != null) { try { con.close(); } catch (SQLException e) { // ignored } } } }
Comment From: harawata
Seems to be fixed by #1765 .