Package hudson

Examples of hudson.AbortException


        ParametersAction a = null;
        if (!parameters.isEmpty()) {
            ParametersDefinitionProperty pdp = job.getProperty(ParametersDefinitionProperty.class);
            if (pdp==null)
                throw new AbortException(job.getFullDisplayName()+" is not parameterized but the -p option was specified");

            List<ParameterValue> values = new ArrayList<ParameterValue>();

            for (Entry<String, String> e : parameters.entrySet()) {
                String name = e.getKey();
                ParameterDefinition pd = pdp.getParameterDefinition(name);
                if (pd==null)
                    throw new AbortException(String.format("\'%s\' is not a valid parameter. Did you mean %s?",
                            name, EditDistance.findNearest(name, pdp.getParameterDefinitionNames())));
                values.add(pd.createValue(this,e.getValue()));
            }
           
            a = new ParametersAction(values);
View Full Code Here


            int exit = starter
                    .stdin(new ByteArrayInputStream("yes".getBytes())).stdout(out)
                    .pwd(new FilePath(launcher.getChannel(), expectedLocation)).join();
            if (exit != 0)
                throw new AbortException(Messages.JDKInstaller_FailedToInstallJDK(exit));

            // JDK creates its own sub-directory, so pull them up
            List<String> paths = fs.listSubDirectories(expectedLocation);
            for (Iterator<String> itr = paths.iterator(); itr.hasNext();) {
                String s =  itr.next();
                if (!s.matches("j(2s)?dk.*"))
                    itr.remove();
            }
            if(paths.size()!=1)
                throw new AbortException("Failed to find the extracted JDKs: "+paths);

            // remove the intermediate directory
            fs.pullUp(expectedLocation+'/'+paths.get(0),expectedLocation);
            break;
        case WINDOWS:
            /*
                Windows silent installation is full of bad know-how.

                On Windows, command line argument to a process at the OS level is a single string,
                not a string array like POSIX. When we pass arguments as string array, JRE eventually
                turn it into a single string with adding quotes to "the right place". Unfortunately,
                with the strange argument layout of InstallShield (like /v/qn" INSTALLDIR=foobar"),
                it appears that the escaping done by JRE gets in the way, and prevents the installation.
                Presumably because of this, my attempt to use /q/vn" INSTALLDIR=foo" didn't work with JDK5.

                I tried to locate exactly how InstallShield parses the arguments (and why it uses
                awkward option like /qn, but couldn't find any. Instead, experiments revealed that
                "/q/vn ARG ARG ARG" works just as well. This is presumably due to the Visual C++ runtime library
                (which does single string -> string array conversion to invoke the main method in most Win32 process),
                and this consistently worked on JDK5 and JDK4.

                Some of the official documentations are available at
                - http://java.sun.com/j2se/1.5.0/sdksilent.html
                - http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/silent.html
             */
            String logFile = jdkBundle+".install.log";

            ArgumentListBuilder args = new ArgumentListBuilder();
            args.add(jdkBundle);
            if (isJava15() || isJava14()) {
                args.add("/s","/v/qn REBOOT=ReallySuppress INSTALLDIR=\\\""+ expectedLocation +"\\\" /L \\\""+logFile+"\\\"");
            } else {
                // modern version supports arguments in more sane format.
                args.add("/s","/v","/qn","/L","\\\""+logFile+"\\\"","REBOOT=ReallySuppress","INSTALLDIR=\\\""+ expectedLocation+"\\\"");
            }
            // according to http://community.acresso.com/showthread.php?t=83301, \" is the trick to quote values with whitespaces.
            // Oh Windows, oh windows, why do you have to be so difficult?
            int r = launcher.launch().cmds(args).stdout(out)
                    .pwd(new FilePath(launcher.getChannel(), expectedLocation)).join();
            if (r != 0) {
                out.println(Messages.JDKInstaller_FailedToInstallJDK(r));
                // log file is in UTF-16
                InputStreamReader in = new InputStreamReader(fs.read(logFile), "UTF-16");
                try {
                    IOUtils.copy(in,new OutputStreamWriter(out));
                } finally {
                    in.close();
                }
                throw new AbortException();
            }

            fs.delete(logFile);

            break;
View Full Code Here

            }
        }

        if(primary==null)   primary=secondary;
        if(primary==null)
            throw new AbortException("Couldn't find the right download for "+platform+" and "+ cpu +" combination");
        LOGGER.fine("Platform choice:"+primary);

        log.getLogger().println("Downloading JDK from "+primary.filepath);

        HttpClient hc = new HttpClient();
        hc.getParams().setParameter("http.useragent","Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)");
        Jenkins j = Jenkins.getInstance();
        ProxyConfiguration jpc = j!=null ? j.proxy : null;
        if(jpc != null) {
            hc.getHostConfiguration().setProxy(jpc.name, jpc.port);
            if(jpc.getUserName() != null)
                hc.getState().setProxyCredentials(AuthScope.ANY,new UsernamePasswordCredentials(jpc.getUserName(),jpc.getPassword()));
        }

        int authCount=0, totalPageCount=0// counters for avoiding infinite loop

        HttpMethodBase m = new GetMethod(primary.filepath);
        hc.getState().addCookie(new Cookie(".oracle.com","gpw_e24",".", "/", -1, false));
        try {
            while (true) {
                if (totalPageCount++>16) // looping too much
                    throw new IOException("Unable to find the login form");

                LOGGER.fine("Requesting " + m.getURI());
                int r = hc.executeMethod(m);
                if (r/100==3) {
                    // redirect?
                    String loc = m.getResponseHeader("Location").getValue();
                    m.releaseConnection();
                    m = new GetMethod(loc);
                    continue;
                }
                if (r!=200)
                    throw new IOException("Failed to request " + m.getURI() +" exit code="+r);

                if (m.getURI().getHost().equals("login.oracle.com")) {
                    LOGGER.fine("Appears to be a login page");
                    String resp = IOUtils.toString(m.getResponseBodyAsStream(), m.getResponseCharSet());
                    m.releaseConnection();
                    Matcher pm = Pattern.compile("<form .*?action=\"([^\"]*)\" .*?</form>", Pattern.DOTALL).matcher(resp);
                    if (!pm.find())
                        throw new IllegalStateException("Unable to find a form in the response:\n"+resp);

                    String form = pm.group();
                    PostMethod post = new PostMethod(
                            new URL(new URL(m.getURI().getURI()),pm.group(1)).toExternalForm());

                    String u = getDescriptor().getUsername();
                    Secret p = getDescriptor().getPassword();
                    if (u==null || p==null) {
                        log.hyperlink(getCredentialPageUrl(),"Oracle now requires Oracle account to download previous versions of JDK. Please specify your Oracle account username/password.\n");
                        throw new AbortException("Unable to install JDK unless a valid Oracle account username/password is provided in the system configuration.");
                    }

                    for (String fragment : form.split("<input")) {
                        String n = extractAttribute(fragment,"name");
                        String v = extractAttribute(fragment,"value");
                        if (n==null || v==null)     continue;
                        if (n.equals("ssousername"))
                            v = u;
                        if (n.equals("password")) {
                            v = p.getPlainText();
                            if (authCount++ > 3) {
                                log.hyperlink(getCredentialPageUrl(),"Your Oracle account doesn't appear valid. Please specify a valid username/password\n");
                                throw new AbortException("Unable to install JDK unless a valid username/password is provided.");
                            }
                        }
                        post.addParameter(n, v);
                    }

View Full Code Here

    protected int run() throws Exception {
        Jenkins.getInstance().getInjector().injectMembers(this);

        iOSDevice dev = devices.getDevice(device);
        if (dev==null)
            throw new AbortException("No such device found: "+device);

        TaskListener listener = new StreamTaskListener(stdout,getClientCharset());
        for (String bundle : files) {
            FilePath p = new FilePath(checkChannel(), bundle);
            listener.getLogger().println("Deploying "+ bundle);
View Full Code Here

        // Expand matrix and build variables in the device ID and command line args
        final String device = expandVariables(build, listener, udid);

        iOSDevice dev = devices.getDevice(device);
        if (dev == null) {
            throw new AbortException("No such device: "+device);
        }

        FilePath ws = build.getWorkspace();
        FilePath[] files = ws.child(path).exists() ? new FilePath[]{ws.child(path)} : ws.list(path);
        if (files.length == 0) {
View Full Code Here

    public Latch(int n) {
        this.n = n;
    }

    public synchronized void abort(Throwable cause) {
        interrupted = new AbortException();
        if (cause!=null)
            interrupted.initCause(cause);
        notifyAll();
    }
View Full Code Here

                URL url;
                try {
                    url = new URL(data);
                } catch (MalformedURLException e) {
                    throw new AbortException("Unable to find the data " + data);
                }
                InputStream s = url.openStream();
                try {
                    return IOUtils.toString(s);
                } finally {
View Full Code Here

            Message.setDefaultLogger(new IvyMessageImpl());
           
            File settingsLoc = (ivySettingsFile == null) ? null : new File(ivySettingsFile);

            if ((settingsLoc != null) && (!settingsLoc.exists())) {
                throw new AbortException(Messages.IvyModuleSetBuild_NoSuchIvySettingsFile(settingsLoc.getAbsolutePath()));
            }
           
            ArrayList<File> propertyFiles = new ArrayList<File>();
            if (StringUtils.isNotBlank(ivySettingsPropertyFiles)) {
                for (String file : StringUtils.split(ivySettingsPropertyFiles, ',')) {
                    File propertyFile = new File(workspaceProper, file.trim());
                    if (!propertyFile.exists()) {
                        propertyFile = new File(file.trim());
                        if (!propertyFile.isAbsolute() || !propertyFile.exists()) {
                            throw new AbortException(Messages.IvyModuleSetBuild_NoSuchPropertyFile(file));
                        }
                    }
                    propertyFiles.add(propertyFile);
                }
            }
View Full Code Here

        @Override
        void preModule(BuildEvent event) throws InterruptedException, IOException, AbortException {
            for (IvyReporter r : reporters)
                if (!r.enterModule(buildProxy, event, listener))
                    throw new AbortException(r + " failed");
        }
View Full Code Here

        @Override
        void postModule(BuildEvent event) throws InterruptedException, IOException, AbortException {
            for (IvyReporter r : reporters)
                if (!r.leaveModule(buildProxy, event, listener))
                    throw new AbortException(r + " failed");
        }
View Full Code Here

TOP

Related Classes of hudson.AbortException

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.