if (hasTimestamp == hasExpires) {
throw new QueryException(QueryError.InvalidArgument,
"Request must have timestamp or expiration, but not both");
}
final QueryUser user;
try {
user = userDetailsService.loadUserByUsername(accessId);
} catch (UsernameNotFoundException e) {
throw new QueryException(QueryError.InvalidClientTokenId, e);
} catch (DataAccessException e) {
throw new QueryException(QueryError.InternalError,
"Failed to retrieve user token for provided accessID", e);
}
final String secret = user.getSecret();
final String stringToSign;
if (SIGNATURE_VERSION_2.equals(signatureVersion)) {
stringToSign = getStringToSign_v2(request);
} else {