Source:
public Comment[] getComments(ApiTypeWrapper apiTypeWrapper) throws APIManagementException { List<Comment> commentList = new ArrayList<Comment>(); Connection connection = null; ResultSet resultSet = null; PreparedStatement prepStmt = null; Boolean isProduct = apiTypeWrapper.isAPIProduct(); int id = -1; String sqlQuery; if(!isProduct) { sqlQuery = SQLConstants.GET_COMMENTS_SQL; } else { sqlQuery = SQLConstants.GET_API_PRODUCT_COMMENTS_SQL; } Identifier identifier; try { connection = APIMgtDBUtil.getConnection(); if (!isProduct) { identifier = apiTypeWrapper.getApi().getId(); id = getAPIID(apiTypeWrapper.getApi().getId(), connection); } else { identifier = apiTypeWrapper.getApiProduct().getId(); id = getAPIID(apiTypeWrapper.getApiProduct().getId(), connection); } if (id == -1) { String msg = "Could not load API record for: " + identifier.getName(); log.error(msg); throw new APIManagementException(msg); } prepStmt = connection.prepareStatement(sqlQuery); prepStmt.setString(1, APIUtil.replaceEmailDomainBack(identifier.getProviderName())); prepStmt.setString(2, identifier.getName()); prepStmt.setString(3, identifier.getVersion()); resultSet = prepStmt.executeQuery(); while (resultSet.next()) { Comment comment = new Comment(); comment.setId(resultSet.getString("COMMENT_ID")); comment.setText(resultSet.getString("COMMENT_TEXT")); comment.setUser(resultSet.getString("COMMENTED_USER")); comment.setCreatedTime(resultSet.getTimestamp("DATE_COMMENTED")); commentList.add(comment); } } catch (SQLException e) { try { if (connection != null) { connection.rollback(); } } catch (SQLException e1) { log.error("Failed to retrieve comments ", e1); } handleException("Failed to retrieve comments for " + apiTypeWrapper.getName(), e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, resultSet); } return commentList.toArray(new Comment[commentList.size()]); }

Target:
public Comment[] getComments(ApiTypeWrapper apiTypeWrapper) throws APIManagementException { List<Comment> commentList = new ArrayList<Comment>(); Connection connection = null; ResultSet resultSet = null; PreparedStatement prepStmt = null; boolean isProduct = apiTypeWrapper.isAPIProduct(); int id = -1; String sqlQuery; if(!isProduct) { sqlQuery = SQLConstants.GET_COMMENTS_SQL; } else { sqlQuery = SQLConstants.GET_API_PRODUCT_COMMENTS_SQL; } Identifier identifier; try { connection = APIMgtDBUtil.getConnection(); if (!isProduct) { identifier = apiTypeWrapper.getApi().getId(); } else { identifier = apiTypeWrapper.getApiProduct().getId(); } id = getAPIID(identifier, connection); if (id == -1) { String msg = "Could not load API record for: " + identifier.getName(); log.error(msg); throw new APIManagementException(msg); } prepStmt = connection.prepareStatement(sqlQuery); prepStmt.setString(1, APIUtil.replaceEmailDomainBack(identifier.getProviderName())); prepStmt.setString(2, identifier.getName()); prepStmt.setString(3, identifier.getVersion()); resultSet = prepStmt.executeQuery(); while (resultSet.next()) { Comment comment = new Comment(); comment.setId(resultSet.getString("COMMENT_ID")); comment.setText(resultSet.getString("COMMENT_TEXT")); comment.setUser(resultSet.getString("COMMENTED_USER")); comment.setCreatedTime(resultSet.getTimestamp("DATE_COMMENTED")); commentList.add(comment); } } catch (SQLException e) { try { if (connection != null) { connection.rollback(); } } catch (SQLException e1) { log.error("Failed to retrieve comments ", e1); } handleException("Failed to retrieve comments for " + apiTypeWrapper.getName(), e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, resultSet); } return commentList.toArray(new Comment[commentList.size()]); }