Skip to content

Commit

Permalink
Add duplication code
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-vinot-sonarsource committed Oct 17, 2023
1 parent 82920d6 commit 8b40517
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/main/java/test/Pikachu.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ private static PreparedStatement createStatement(String projectUuid, Collection<
"where pp.user_uuid is not null and (pp.entity_uuid is null or pp.entity_uuid=?) ";
PreparedStatement res = connection.prepareStatement(sql);
res.setString(1, projectUuid);
int index = 2;
//For loop
int j = 0;
for (int i = 1; i <= 100; ++i) {
j += i;
if (j % 2 == 0) {
j += 1;
} else {
j +=2;
}
}
int index = 2 + j;
for (String dispatcherKey : dispatcherKeys) {
res.setString(index, "PREFIX" + dispatcherKey + ".%");
index++;
Expand All @@ -35,7 +45,17 @@ private static PreparedStatement createStatement2(String projectUuid, Collection
"where pp.user_uuid is not null and (pp.entity_uuid is null or pp.entity_uuid=?) ";
PreparedStatement res = connection.prepareStatement(sql);
res.setString(1, projectUuid);
int index = 2;
//For loop
int j = 0;
for (int i = 1; i <= 100; ++i) {
j += i;
if (j % 2 == 0) {
j += 1;
} else {
j +=2;
}
}
int index = 2 + j;
for (String dispatcherKey : dispatcherKeys) {
res.setString(index, "PREFIX" + dispatcherKey + ".%");
index++;
Expand Down

0 comments on commit 8b40517

Please sign in to comment.