~ubuntu-branches/ubuntu/trusty/jenkins/trusty

« back to all changes in this revision

Viewing changes to .pc/dependency-upgrades/0012-jnr-posix-upgrade.patch/core/src/main/java/hudson/os/PosixAPI.java

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-13 12:35:19 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20130813123519-tizgfxcr70trl7r0
Tags: 1.509.2+dfsg-1
* New upstream release (Closes: #706725):
  - d/control: Update versioned BD's:
    * jenkins-executable-war >= 1.28.
    * jenkins-instance-identity >= 1.3.
    * libjenkins-remoting-java >= 2.23.
    * libjenkins-winstone-java >= 0.9.10-jenkins-44.
    * libstapler-java >= 1.207.
    * libjenkins-json-java >= 2.4-jenkins-1.
    * libstapler-adjunct-timeline-java >= 1.4.
    * libstapler-adjunct-codemirror-java >= 1.2.
    * libmaven-hpi-plugin-java >= 1.93.
    * libjenkins-xstream-java >= 1.4.4-jenkins-3.
  - d/maven.rules: Map to older version of animal-sniffer-maven-plugin.
  - Add patch for compatibility with guava >= 0.14.
  - Add patch to exclude asm4 dependency via jnr-posix.
  - Fixes the following security vulnerabilities:
    CVE-2013-2034, CVE-2013-2033, CVE-2013-2034, CVE-2013-1808
* d/patches/*: Switch to using git patch-queue for managing patches.
* De-duplicate jars between libjenkins-java and jenkins-external-job-monitor
  (Closes: #701163):
  - d/control: Add dependency between jenkins-external-job-monitor ->
    libjenkins-java.
  - d/rules: 
    Drop installation of jenkins-core in jenkins-external-job-monitor.
  - d/jenkins-external-job-monitor.{links,install}: Link to jenkins-core
    in /usr/share/java instead of included version.
* Wait longer for jenkins to stop during restarts (Closes: #704848):
  - d/jenkins.init: Re-sync init script from upstream codebase.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package hudson.os;
 
2
 
 
3
import org.jruby.ext.posix.JavaPOSIX;
 
4
import org.jruby.ext.posix.POSIX;
 
5
import org.jruby.ext.posix.POSIXFactory;
 
6
import org.jruby.ext.posix.POSIXHandler;
 
7
import org.jruby.ext.posix.POSIX.ERRORS;
 
8
 
 
9
import java.io.File;
 
10
import java.io.InputStream;
 
11
import java.io.PrintStream;
 
12
import java.util.Map;
 
13
import java.util.logging.Logger;
 
14
 
 
15
/**
 
16
 * POSIX API wrapper.
 
17
 * 
 
18
 * @author Kohsuke Kawaguchi
 
19
 */
 
20
public class PosixAPI {
 
21
    public static POSIX get() {
 
22
        return posix;
 
23
    }
 
24
 
 
25
    /**
 
26
     * @deprecated as of 1.448
 
27
     *      Use {@link #supportsNative()}.
 
28
     */
 
29
    public boolean isNative() {
 
30
        return supportsNative();
 
31
    }
 
32
 
 
33
    /**
 
34
     * Determine if the jna-posix library could not provide native support, and
 
35
     * used a fallback java implementation which does not support many operations.
 
36
     */
 
37
    public static boolean supportsNative() {
 
38
        return !(posix instanceof JavaPOSIX);
 
39
    }
 
40
    
 
41
    private static final POSIX posix = POSIXFactory.getPOSIX(new POSIXHandler() {
 
42
        public void error(ERRORS errors, String s) {
 
43
            throw new PosixException(s,errors);
 
44
        }
 
45
 
 
46
        public void unimplementedError(String s) {
 
47
            throw new UnsupportedOperationException(s);
 
48
        }
 
49
 
 
50
        public void warn(WARNING_ID warning_id, String s, Object... objects) {
 
51
            LOGGER.fine(s);
 
52
        }
 
53
 
 
54
        public boolean isVerbose() {
 
55
            return true;
 
56
        }
 
57
 
 
58
        public File getCurrentWorkingDirectory() {
 
59
            return new File(".").getAbsoluteFile();
 
60
        }
 
61
 
 
62
        public String[] getEnv() {
 
63
            Map<String,String> envs = System.getenv();
 
64
            String[] envp = new String[envs.size()];
 
65
            
 
66
            int i = 0;
 
67
            for (Map.Entry<String,String> e : envs.entrySet()) {
 
68
                envp[i++] = e.getKey()+'+'+e.getValue();
 
69
            }
 
70
            return envp;
 
71
        }
 
72
 
 
73
        public InputStream getInputStream() {
 
74
            return System.in;
 
75
        }
 
76
 
 
77
        public PrintStream getOutputStream() {
 
78
            return System.out;
 
79
        }
 
80
 
 
81
        public int getPID() {
 
82
            // TODO
 
83
            return 0;
 
84
        }
 
85
 
 
86
        public PrintStream getErrorStream() {
 
87
            return System.err;
 
88
        }
 
89
    }, true);
 
90
 
 
91
    private static final Logger LOGGER = Logger.getLogger(PosixAPI.class.getName());
 
92
}