CPD Results
The following document contains the results of PMD's CPD 6.53.0.
Duplications
File |
Line |
net/avcompris/commons3/web/AbstractController.java |
129 |
net/avcompris/commons3/web/AbstractController.java |
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 |
Line |
net/avcompris/commons3/web/AbstractController.java |
174 |
net/avcompris/commons3/web/AbstractController.java |
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, |