java.security.AccessController#doPrivilegedWithCombiner ( )源码实例Demo

下面列出了java.security.AccessController#doPrivilegedWithCombiner ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: HttpURLConnection.java
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();
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: HttpURLConnection.java
@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();
    }
}
 
源代码3 项目: dragonwell8_jdk   文件: HttpURLConnection.java
@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();
    }
}
 
源代码4 项目: TencentKona-8   文件: HttpURLConnection.java
@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();
    }
}
 
源代码5 项目: TencentKona-8   文件: HttpURLConnection.java
@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();
    }
}
 
源代码6 项目: jdk8u60   文件: HttpURLConnection.java
@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();
    }
}
 
源代码7 项目: jdk8u60   文件: HttpURLConnection.java
@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();
    }
}
 
源代码8 项目: openjdk-jdk8u   文件: HttpURLConnection.java
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();
    }
}
 
源代码9 项目: openjdk-jdk8u   文件: HttpURLConnection.java
@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();
    }
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, p1, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, p1, null);
}