Package org.codinjutsu.tools.jenkins.exception

Examples of org.codinjutsu.tools.jenkins.exception.ConfigurationException


            }
            if (isRedirection(statusCode)) {
                responseCollector.collect(statusCode, post.getResponseHeader("Location").getValue());
            }
        } catch (HttpException httpEx) {
            throw new ConfigurationException(String.format("HTTP Error during method execution '%s': %s", url, httpEx.getMessage()), httpEx);
        } catch (UnknownHostException uhEx) {
            throw new ConfigurationException(String.format("Unknown server: %s", uhEx.getMessage()), uhEx);
        } catch (IOException ioEx) {
            throw new ConfigurationException(String.format("IO Error during method execution '%s': %s", url, ioEx.getMessage()), ioEx);
        } finally {
            IOUtils.closeQuietly(inputStream);
            post.releaseConnection();
        }
    }
View Full Code Here


            String responseBody = IOUtils.toString(inputStream, post.getResponseCharSet());
            if (responseCode != HttpURLConnection.HTTP_OK) {
                checkResponse(responseCode, responseBody);
            }
        } catch (HttpException httpEx) {
            throw new ConfigurationException(String.format("HTTP Error during method execution '%s': %s", jenkinsUrl.toString(), httpEx.getMessage()), httpEx);
        } catch (IOException ioEx) {
            throw new ConfigurationException(String.format("IO Error during method execution '%s': %s", jenkinsUrl.toString(), ioEx.getMessage()), ioEx);
        } finally {
            IOUtils.closeQuietly(inputStream);
            post.releaseConnection();
        }
    }
View Full Code Here

        int jenkinsPort = url.getPort();
        URL viewUrl = urlBuilder.createViewUrl(jenkinsPlateform, jenkins.getPrimaryView().getUrl());
        int viewPort = viewUrl.getPort();

        if (isJenkinsPortSet(jenkinsPort) && jenkinsPort != viewPort) {
            throw new ConfigurationException(String.format("Jenkins Server Port Mismatch: expected='%s' - actual='%s'. Look at the value of 'Jenkins URL' at %s/configure", jenkinsPort, viewPort, configuration.getServerUrl()));
        }

        if (!StringUtils.equals(url.getHost(), viewUrl.getHost())) {
            throw new ConfigurationException(String.format("Jenkins Server Host Mismatch: expected='%s' - actual='%s'. Look at the value of 'Jenkins URL' at %s/configure", url.getHost(), viewUrl.getHost(), configuration.getServerUrl()));
        }

        return jenkins;
    }
View Full Code Here

                int intValue = Integer.parseInt(value);
                if (intValue <= 0) {
                    throw new NumberFormatException();
                }
            } catch (NumberFormatException ex) {
                throw new ConfigurationException(String.format("'%s' is not a positive integer", value));
            }
        }
    }
View Full Code Here

        String value = component.getText();
        if (component.isEnabled() && StringUtils.isNotEmpty(value)) {    //TODO A revoir
            try {
                int intValue = Integer.parseInt(value);
                if (intValue < 0)
                    throw new ConfigurationException(String.format("'%s' is not a positive integer", value));
            } catch (NumberFormatException ex) {
                throw new ConfigurationException(String.format("'%s' is not a positive integer", value));
            }
        }
    }
View Full Code Here

            String userInfo = url.getUserInfo();
            if (StringUtils.isEmpty(userInfo)) {
                return;
            }

            throw new ConfigurationException("Credentials should not be embedded in the url. Use the above form instead.");
        } catch (MalformedURLException ex) {
            throw new ConfigurationException(String.format("URL '%s' is malformed", value));
        }
    }
View Full Code Here

public class NotNullValidator implements UIValidator<JTextField> {
    public void validate(JTextField component) throws ConfigurationException {
        if (component.isEnabled()) {    //TODO a revoir
            String value = component.getText();
            if (StringUtils.isEmpty(value)) {
                throw new ConfigurationException(String.format("'%s' must be set", component.getName()));
            }
        }
    }
View Full Code Here

        if (StringUtils.isEmpty(filepath)) {
            return;
        }
        File file = new File(filepath);
        if (!file.exists() || !file.isFile()) {
            throw new ConfigurationException(String.format("'%s' is not a file", filepath));
        }

    }
View Full Code Here

                .addValidator(username, new UIValidator<JTextField>() {
                    public void validate(JTextField component) throws ConfigurationException {
                        if (StringUtils.isNotBlank(component.getText())) {
                            String password = getPassword();
                            if (StringUtils.isBlank(password)) {
                                throw new ConfigurationException(String.format("'%s' must be set", passwordField.getName()));
                            }
                        }
                    }
                });
View Full Code Here

                                    );

                                    watchJob(browserPanel, selectedJob);

                                } else {
                                    throw new ConfigurationException(String.format("File \"%s\" not found", virtualFile.getPath()));
                                }
                            } else {
                                throw new ConfigurationException(String.format("Job \"%s\" should has parameter with name \"%s\"", selectedJob.getName(), UploadPatchToJob.PARAMETER_NAME));
                            }
                        } else {
                            throw new ConfigurationException(String.format("Job \"%s\" has no parameters", selectedJob.getName()));
                        }
                    }
                }
            }
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.codinjutsu.tools.jenkins.exception.ConfigurationException

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.