Package com.denimgroup.threadfix.exception

Examples of com.denimgroup.threadfix.exception.DefectTrackerCommunicationException


        LOG.debug(defectXml);

        String result = restUtils.postUrlAsString(getUrlWithRest() + "Defect", defectXml, getUsername(), getPassword(), CONTENT_TYPE);

        if (result == null) {
            throw new DefectTrackerCommunicationException("ThreadFix was unable to submit a defect to the tracker.");
        }

        return getDefectNumber(result);
    }
View Full Code Here


        String result = restUtils.getUrlAsString(getUrlWithRest().replace("Data/", "") +
                "New/Defect?ctx=" + urlEncode(getProjectId()), getUsername(), getPassword());

        if (result == null) {
            throw new DefectTrackerCommunicationException("Received null response while attempting to get " +
                    "the asset information from the VersionOne server.");
        }

        return MarshallingUtils.marshal(Assets.Asset.class, result);
    }
View Full Code Here

            id = id.replace(":","/");
        String numberXmlDefect = restUtils.getUrlAsString(getUrlWithRest() +
                id + "?sel=Number", getUsername(), getPassword());

        if (numberXmlDefect == null) {
            throw new DefectTrackerCommunicationException("Received null response from server.");
        }

        asset = MarshallingUtils.marshal(Assets.Asset.class, numberXmlDefect);
        if (asset != null && asset.getAttributes() != null
                && !asset.getAttributes().isEmpty()
View Full Code Here

            redirectTimes = 0;
            return ret;

        } catch (IOException e) {
            redirectTimes = 0;
            throw new DefectTrackerCommunicationException(e, "Unable to communicate with the HPQC server.");
        } catch (RestRedirectException e) {

            // Only redirect up to 5 times
            if (redirectTimes >= 5) {
                log.warn("Already redirected " + redirectTimes +" times, not going to do it anymore");
View Full Code Here

            inputStream = con.getErrorStream();
        }

        if (inputStream == null) {
            throw new DefectTrackerCommunicationException(
                    "Server response was null, received response code " + responseCode);
        }

        // This actually takes the data from the previously set stream
        // (error or input) and stores it in a byte[] inside the response
View Full Code Here

            }
        } else {
            log.warn("Got " + serverResponse.getStatusCode() + " response instead of 200.");
        }

        throw new DefectTrackerCommunicationException("Unable to retrieve projects.");
    }
View Full Code Here

        String newDefectId = getFieldValue(newDefect, "id");
        if (newDefectId != null && !newDefectId.isEmpty()) {
            log.info("New defect was created in HPQC with Id " + newDefectId);
            return newDefectId;
        } else {
            throw new DefectTrackerCommunicationException("Unable to post defect to HPQC.");
        }
    }
View Full Code Here

            Response serverResponse = con.httpGet(getUrl, null, requestHeaders);
            if (serverResponse.getStatusCode() == HttpURLConnection.HTTP_OK) {
                return serverResponse;
            } else {
                log.warn("The response for the get request was " + serverResponse.getStatusCode() + ", not 200.");
                throw new DefectTrackerCommunicationException(
                        "Got " + serverResponse.getStatusCode() + " response from server.");
            }
        } else {
            throw new DefectTrackerCommunicationException("Invalid project selected.");
        }
    }
View Full Code Here

                    statusCode == HttpURLConnection.HTTP_CREATED ||
                    statusCode == HttpURLConnection.HTTP_ACCEPTED) {
                return serverResponse;
            } else {
                log.warn("The response for the get request was " + serverResponse.getStatusCode() + ", not 200.");
                throw new DefectTrackerCommunicationException(
                        "Got " + serverResponse.getStatusCode() + " response from server.");
            }
        } else {
            throw new DefectTrackerCommunicationException("Invalid project selected.");
        }
    }
View Full Code Here

                ret = newUrl;
            }

            //Not ok, not unauthorized. An error, such as 404, or 500
            else {
                throw new DefectTrackerCommunicationException(
                        "Unable to communicate with the HPQC server. Response code was " + responseCode);
            }

            return ret;
        } catch (RestRedirectException e) {
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.exception.DefectTrackerCommunicationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.