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

The following are Jave code examples for showing how to use doPrivilegedWithCombiner() of the java.security.AccessController class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jdk8u-jdk   File: HttpURLConnection.java   View Source Code Vote up 6 votes
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 2
Project: jdk8u-jdk   File: HttpURLConnection.java   View Source Code Vote up 6 votes
@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 3
Project: jdk8u-jdk   File: HttpURLConnection.java   View Source Code Vote up 6 votes
@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 4
Project: openjdk-jdk10   File: HttpURLConnection.java   View Source Code Vote up 6 votes
protected void plainConnect()  throws IOException {
    synchronized (this) {
        if (connected) {
            return;
        }
    }
    SocketPermission p = URLtoSocketPermission(this.url);
    if (p != null) {
        try {
            AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<>() {
                    public Void run() throws IOException {
                        plainConnect0();
                        return null;
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
                throw (IOException) e.getException();
        }
    } else {
        // run without additional permission
        plainConnect0();
    }
}
 
Example 5
Project: openjdk-jdk10   File: HttpURLConnection.java   View Source Code Vote up 6 votes
@Override
public synchronized OutputStream getOutputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<>() {
                    public OutputStream run() throws IOException {
                        return getOutputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getOutputStream0();
    }
}
 
Example 6
Project: openjdk-jdk10   File: HttpURLConnection.java   View Source Code Vote up 6 votes
@Override
public synchronized InputStream getInputStream() throws IOException {
    connecting = true;
    SocketPermission p = URLtoSocketPermission(this.url);

    if (p != null) {
        try {
            return AccessController.doPrivilegedWithCombiner(
                new PrivilegedExceptionAction<>() {
                    public InputStream run() throws IOException {
                        return getInputStream0();
                    }
                }, null, p
            );
        } catch (PrivilegedActionException e) {
            throw (IOException) e.getException();
        }
    } else {
        return getInputStream0();
    }
}
 
Example 7
Project: jdk8u-jdk   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
Example 8
Project: jdk8u-jdk   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, p1, null);
}
 
Example 9
Project: jdk8u-jdk   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
Example 10
Project: jdk8u-jdk   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
Example 11
Project: openjdk-jdk10   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
Example 12
Project: openjdk-jdk10   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, p1, null);
}
 
Example 13
Project: openjdk-jdk10   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
Example 14
Project: openjdk-jdk10   File: LimitedDoPrivilegedWithNullPerms.java   View Source Code Vote up 4 votes
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}