@GET public final Response get(@Context UriInfo uriInfo, @Context HttpHeaders headers, @PathParam("path") String path) { final URI uri = buildUri(path, uriInfo.getQueryParameters()); logger.info("Getting URI: '{}'", uri); final Request<?, com.atlassian.sal.api.net.Response> salRequest = buildSalRequest(uri, headers.getRequestHeaders()); try { return salRequest.executeAndReturn(new JaxRsResponseHandler()); } catch (ResponseException e) { return Response.serverError().entity(e.getMessage()).build(); } }
resp.sendError(404, "A credentials error occurred when executing a request to the remote application"); } catch (ResponseException e) { log.error("doGet - Caught a response exception:" + e.getMessage()); resp.sendError(404, "An error occurred when executing a request to the remote application");
private void addOrRemoveConsumer(final ApplicationLink applicationLink, final boolean enabled, final Map<String, String> fieldErrorMessages) throws IOException { if (enabled) { try { final Consumer consumer = OAuthHelper.fetchConsumerInformation(applicationLink); serviceProviderStoreService.addConsumer(consumer, applicationLink); } catch (ResponseException e) { LOG.error("Error occurred when trying to fetch the consumer information from the remote application for application link '" + applicationLink + "'", e); fieldErrorMessages.put(COMMUNICATION_CONTEXT_PARAM, i18nResolver.getText("auth.oauth.config.error.communication.consumer", e.getMessage())); } catch (Exception e) { LOG.error("Error occurred when trying to store consumer information for application link '" + applicationLink + "'", e); fieldErrorMessages.put(COMMUNICATION_CONTEXT_PARAM, i18nResolver.getText("auth.oauth.config.error.consumer.add", e.getMessage())); } } else { try { serviceProviderStoreService.removeConsumer(applicationLink); } catch (Exception e) { LOG.error("Error occurred when trying to remove consumer from application link '" + applicationLink + "'.", e); fieldErrorMessages.put(COMMUNICATION_CONTEXT_PARAM, i18nResolver.getText("auth.oauth.config.error.consumer.remove", e.getMessage())); } } }
/** * We send the message to the partitions * * @param message the message * @param partition the partition * @param roomMap the map with each room information */ private void sendMessageToCurrentPartition(String message, List<String> partition, Map<String, Result<ExpandedRoom>> roomMap) { int errorCount = 0; for (String room : partition) { try { Result<ExpandedRoom> expandedRoom = roomMap.get(room); if (expandedRoom.isSuccess() && !expandedRoom.success().getIsGuestAccessible()) { api.notifyRoom(room, message, HipChatNotificationOptions.GREEN); } } catch (ResponseException e) { logger.error(" Error while sending message to HipChat", e.getMessage()); errorCount++; // If we reached 3 errors, then we break this partition, and wait for the other if (errorCount >= RETRIES) { break; } } } }
log.info("Error connecting to server: " + e.getMessage(), e); addError("url", getText("editinstances.errors.connection"));
connectionErrors.add("Unexpected error when connecting to '" + applicationLink.getName() + "' (" + ex.getMessage() + ")");
private <T> Either<NegativeResponseStatus, T> callRestService(Request.MethodType method, final String path, final AbstractJsonResponseHandler<T> handler) { final ApplicationLinkRequestFactory requestFactory = applicationLink.createAuthenticatedRequestFactory(); try { ApplicationLinkRequest request = requestFactory.createRequest(method, path); handler.modifyRequest(request); return request.execute(handler); } catch (CredentialsRequiredException ex) { return Either.left(NegativeResponseStatus.authorizationRequired(jiraLocation)); } catch (ResponseException e) { log.error(String.format("Failed to transform response from Application Link: %s (%s)", jiraLocation.getId(), e.getMessage())); return Either.left(NegativeResponseStatus.communicationFailed(jiraLocation)); } }
+ e.getMessage()); return Collections.emptyMap(); throw new CantGetUsersFromCrowdException("Can not get users from crowd: " + e.getMessage(), e);
log.warn(e.getMessage(), e); return new JiraRestResponse("Request to JIRA failed: " + e.getMessage());
applicationLink.getRpcUrl(), command, e.getMessage()), e);
applicationLink.getRpcUrl(), command, e.getMessage()), e);
log.info("Error connecting to FishEye server: " + e.getMessage(), e); addError("url", getText("editinstances.errors.connection"));
return new RestResponse("Unable to connect to Jenkins. Connection timed out."); } else { return new RestResponse("Failed to execute request: " + e.getMessage());
return new RestResponse("Unable to connect to Jenkins. Connection timed out."); } else { return new RestResponse("Failed to execute request: " + e.getMessage());
@Override protected String doExecute() throws Exception { if (!hasAdministratePermissionOnProject(key)) { return SECURITY_BREACH; } ApplicationLink appLink = appLinksManager.getLinkedApplication(Application.CRUCIBLE.name(), key); Request<?> request = requestFactory.createRequest(Request.MethodType.PUT, getRestResource(appLink)); request.addTrustedTokenAuthentication(themeProperties.getSystemAdministrator()); request.setRequestBody(XStreamUtils.toXML(projectConfig)); try { request.execute(); } catch (ResponseException re) { addErrorMessage(re.getMessage()); log.error("Error putting crucible project config", re); return INPUT; } return getRedirect("CrucibleProject!ListProjects.jspa?message=crucible.admin.info.updated"); }
log.error("Invalid response from getting the pageId: " + e.getMessage());
errorMessage.set("Communication error: " + re.getMessage());
} catch (ResponseException re) { status.set(AuthenticationStatus.COMMUNICATION_ERROR); errorMessage.set(re.getMessage());
log.error("Invalid response from remote JIRA server: " + e.getMessage());