CPD Results
The following document contains the results of PMD's CPD 7.3.0.
Duplications
File |
Line |
org/diabetestechnology/drh/service/http/hub/prime/experimental/ExprimentalJooqController.java |
65 |
org/diabetestechnology/drh/service/http/hub/prime/service/DataAccessService.java |
2366 |
payload.filterModel().forEach((field, filter) -> {
switch (filter.type()) {
case "like" -> conditions.add(field(field).like("%" + filter + "%"));
case "equals" -> conditions.add(field(field).eq(filter));
case "number" -> conditions.add(field(field).eq(filter));
case "date" -> conditions.add(field(field).eq(filter));
case "contains" -> conditions.add(field(field).like("%" + filter + "%"));
default -> throw new IllegalArgumentException(
"Unknown filter type '" + filter.filterType()
+ "' in filter for field '" + field
+ "' see DataAccessService::getEachStudyParticipantDashboard");
}
}); |
File |
Line |
org/diabetestechnology/drh/service/http/hub/prime/service/DataAccessService.java |
1602 |
org/diabetestechnology/drh/service/http/hub/prime/service/DataAccessService.java |
1649 |
LOG.info("getParticipantMetrics: retry attempt: {}", attempt);
// Keeping the code for future reference
// dbLock.lock();
try {
synchronized (this) {
refreshDatabase(dbName);
}
return jdbcTemplate.queryForMap(sql, participantId, startDate, endDate);
} catch (DataAccessException e) {
attempt++;
if (attempt >= maxRetries) {
LOG.error("Error executing SQL query after {} attempts: {}", attempt, e.getMessage(), e);
throw new RuntimeException("Error executing SQL query", e);
}
// Wait a bit before retrying with exponential backoff
try {
Thread.sleep((long) Math.pow(2, attempt) * 100);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
} finally {
// Keeping the code for future reference
// dbLock.unlock();
}
}
throw new RuntimeException("Failed to execute SQL query after maximum retries");
});
} |
File |
Line |
org/diabetestechnology/drh/service/http/hub/prime/service/DataAccessService.java |
352 |
org/diabetestechnology/drh/service/http/hub/prime/service/DataAccessService.java |
2336 |
}, startDate, endDate, participantId);
} catch (DataAccessException e) {
if (e.getCause() instanceof AsyncRequestTimeoutException) {
LOG.warn("Query timed out on attempt {}: {}", attempt, e.getMessage());
}
attempt++;
if (attempt >= maxRetries) {
LOG.error("Error executing SQL query after {} attempts: {}", attempt, e.getMessage(), e);
throw new RuntimeException("Error executing SQL query", e);
}
// Wait a bit before retrying with exponential backoff
try {
Thread.sleep((long) Math.pow(2, attempt) * 100);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
} finally {
// Keeping the code for future reference
// dbLock.unlock();
}
}
throw new RuntimeException("Failed to execute SQL query after maximum retries");
});
} |