Skip to content

Commit bb109c9

Browse files
Modify rule S6909: Fix errors in code examples (#4008)
1 parent bed74da commit bb109c9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

rules/S6909/java/rule.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class DatabaseExample {
2727
public void updateTodayOrders(Connection connection, List<Order> orders) {
2828
Date today = java.sql.Date.valueOf(LocalDate.now());
2929
String insertQuery = "INSERT INTO Order (id, price, executionDate) VALUES (?, ?, ?)";
30-
PreparedStatement preparedStatement = connection.prepareStatement(SQL_INSERT);
30+
PreparedStatement preparedStatement = connection.prepareStatement(insertQuery);
3131
3232
for(Order order: orders) {
3333
preparedStatement.setString(1, order.id());
@@ -50,10 +50,9 @@ public class DatabaseExample {
5050
public void updateTodayOrders(Connection connection, List<Order> orders) {
5151
Date today = java.sql.Date.valueOf(LocalDate.now());
5252
String insertQuery = "INSERT INTO Order (id, price, executionDate) VALUES (?, ?, ?)";
53-
preparedStatement.setDate(3, today); // Compliant
54-
55-
PreparedStatement preparedStatement = connection.prepareStatement(SQL_INSERT);
53+
PreparedStatement preparedStatement = connection.prepareStatement(insertQuery);
5654
55+
preparedStatement.setDate(3, today); // Compliant
5756
for(Order order: orders) {
5857
preparedStatement.setString(1, order.id());
5958
preparedStatement.setString(2, order.price());

0 commit comments

Comments
 (0)