stmt.close();
}
}
catch (SQLException e) {
logger.error("sql-exception", e);
throw new JDBCRepositoryException(e);
}
throw new JDBCRepositoryException(sqle);
}
if (descriptor != null) {
final String languageField =
resolveFieldName(jdbcConnection, LANGUAGE_COLUMN_NAMES);
// find the best mathing descriptor
stmt = null;
try {
stmt = sqlConnection.createStatement();
final String sql =
"select " + categoryNameField + " , " + languageField +
" from " + vmPolicyCategoryTable + " where " +
categoryIDField + " = " + categoryId + " and " +
projectField + " = " +
JDBCAccessorHelper.quoteValue(getProjectName());
if (logger.isDebugEnabled()){
logger.debug(sql);
}
final ResultSet rs = stmt.executeQuery(sql);
final String[] values = getBestMatchingValues(jdbcConnection,
rs, new String[]{categoryNameField}, locale);
descriptor.setCategoryDescriptiveName(values[0]);
descriptor.setLanguage(values[1]);
}
catch (SQLException sqle) {
logger.error("sql-exception", sqle);
try {
if (stmt != null) {
stmt.close();
}
}
catch (SQLException e) {
logger.error("sql-exception", e);
throw new JDBCRepositoryException(e);
}
throw new JDBCRepositoryException(sqle);
}
}
return descriptor;
}