Java Code Examples for java.security.AccessController#doPrivilegedWithCombiner()

The following examples show how to use java.security.AccessController#doPrivilegedWithCombiner() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpURLConnection.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public synchronized OutputStream getOutputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<OutputStream>() {
                    public OutputStream run() throws IOException {
                        return getOutputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getOutputStream0();
    }
}
 
Example 2
Source File: HttpURLConnection.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public synchronized InputStream getInputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<InputStream>() {
                    public InputStream run() throws IOException {
                        return getInputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getInputStream0();
    }
}
 
Example 3
Source File: HttpURLConnection.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected void plainConnect()  throws IOException {
    synchronized (this) {
        if (connected) {
            return;
        }
    }
    SocketPermission p = URLtoSocketPermission(this.url);
    if (p != null) {
        try {
            AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<Void>() {
                    public Void run() throws IOException {
                        plainConnect0();
                        return null;
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
                throw (IOException) e.getException();
        }
    } else {
        // run without additional permission
        plainConnect0();
    }
}
 
Example 4
Source File: HttpURLConnection.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public synchronized InputStream getInputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<InputStream>() {
                    public InputStream run() throws IOException {
                        return getInputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getInputStream0();
    }
}
 
Example 5
Source File: HttpURLConnection.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public synchronized OutputStream getOutputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<OutputStream>() {
                    public OutputStream run() throws IOException {
                        return getOutputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getOutputStream0();
    }
}
 
Example 6
Source File: HttpURLConnection.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public synchronized InputStream getInputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<InputStream>() {
                    public InputStream run() throws IOException {
                        return getInputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getInputStream0();
    }
}
 
Example 7
Source File: HttpURLConnection.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public synchronized OutputStream getOutputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<OutputStream>() {
                    public OutputStream run() throws IOException {
                        return getOutputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getOutputStream0();
    }
}
 
Example 8
Source File: HttpURLConnection.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public synchronized InputStream getInputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<InputStream>() {
                    public InputStream run() throws IOException {
                        return getInputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getInputStream0();
    }
}
 
Example 9
Source File: HttpURLConnection.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected void plainConnect()  throws IOException {
    synchronized (this) {
        if (connected) {
            return;
        }
    }
    SocketPermission p = URLtoSocketPermission(this.url);
    if (p != null) {
        try {
            AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<Void>() {
                    public Void run() throws IOException {
                        plainConnect0();
                        return null;
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
                throw (IOException) e.getException();
        }
    } else {
        // run without additional permission
        plainConnect0();
    }
}
 
Example 10
Source File: LimitedDoPrivilegedWithNullPerms.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
Example 11
Source File: LimitedDoPrivilegedWithNullPerms.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
Example 12
Source File: LimitedDoPrivilegedWithNullPerms.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
Example 13
Source File: LimitedDoPrivilegedWithNullPerms.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
Example 14
Source File: LimitedDoPrivilegedWithNullPerms.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
Example 15
Source File: LimitedDoPrivilegedWithNullPerms.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
Example 16
Source File: LimitedDoPrivilegedWithNullPerms.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
Example 17
Source File: LimitedDoPrivilegedWithNullPerms.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
Example 18
Source File: LimitedDoPrivilegedWithNullPerms.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, p1, null);
}
 
Example 19
Source File: LimitedDoPrivilegedWithNullPerms.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
Example 20
Source File: LimitedDoPrivilegedWithNullPerms.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, p1, null);
}