CPD Results
The following document contains the results of PMD's CPD 6.53.0.
Duplications
File |
Project |
Line |
net/avcompris/commons3/web/AbstractController.java |
avc-commons3-web |
129 |
net/avcompris/commons3/web/AbstractController.java |
avc-commons3-web |
200 |
throws ServiceException {
checkNotNull(request, "request");
checkNotNull(action, "action");
// TODO: How to factor this code with wrapAuthenticatedServletAction()?!
final long startMs = System.currentTimeMillis();
final String authorization = getAuthorization(request);
final String userSessionId = getUserSessionId(request);
final String correlationId = getCorrelationId(request);
sessionPropagator.setAuthorizationHeader(authorization);
sessionPropagator.setUserSessionId(userSessionId);
@Nullable
final User user = authService.getAuthenticatedUser(authorization, userSessionId);
if (user == null) {
throw new UnauthenticatedException();
}
if (userSessionId != null) {
// Use this to propage userSessionId all the way to ApplicationErrorController
//
request.setAttribute(USER_SESSION_ID_ATTRIBUTE_NAME, userSessionId);
}
final Pair<Class<?>, Method> endpoint = extractControllerCurrentEndpoint();
final String methodName = endpoint.getRight().getName();
final Log logger = LogFactory.getLog(endpoint.getLeft());
if (logger.isInfoEnabled()) {
logger.info(methodName + "() started... +ms: " + (System.currentTimeMillis() - startMs));
} |
File |
Project |
Line |
net/avcompris/commons3/core/impl/AbstractServiceImpl.java |
avc-commons3-core |
142 |
net/avcompris/commons3/dao/impl/AbstractDao.java |
avc-commons3-dao |
37 |
throws SQLException, IOException, ServiceException {
checkNotNull(action, "action");
for (final long startMs = System.currentTimeMillis(); System.currentTimeMillis() < startMs + timeoutMs;) {
T result = null;
try {
result = action.action();
} catch (final SQLException | IOException | RuntimeException | Error e) {
throw e;
} catch (final Exception e) {
throw new RuntimeException(e);
}
if (result != null) {
return result;
}
try {
Thread.sleep(delayMs);
} catch (final InterruptedException e) {
e.printStackTrace();
// do nothing
}
}
logger.error("A timeout occurs (" + timeoutMs + " ms)");
if (throwExceptionInCaseOfTimeout) {
throw new RuntimeException("Timeout after: " + timeoutMs + " ms");
} else {
return null;
}
} |
File |
Project |
Line |
net/avcompris/commons3/web/AbstractController.java |
avc-commons3-web |
174 |
net/avcompris/commons3/web/AbstractController.java |
avc-commons3-web |
313 |
try {
result = action.action(correlationId, user);
} catch (final ServiceException e) {
final int httpErrorCode = e.getHttpErrorCode();
final long elapsedMs = System.currentTimeMillis() - startMs;
logger.error(methodName + "() ERROR. " + httpErrorCode + ". elapsedMs: " + elapsedMs, e);
throw e;
}
final long elapsedMs = System.currentTimeMillis() - startMs;
if (logger.isInfoEnabled()) {
logger.info(methodName + "() ended. " + result.getStatusCode() + ". elapsedMs: " + elapsedMs);
}
return enrich(response, userSessionId, result, correlationId);
}
protected final <T> ResponseEntity<T> wrapAuthenticatedServletAction(final HttpServletRequest request, |