Examples of PrivilegedExceptionAction


Examples of java.security.PrivilegedExceptionAction

    protected Class<?> findClass(final String name)
   throws ClassNotFoundException
    {
  try {
      return (Class)
    AccessController.doPrivileged(new PrivilegedExceptionAction() {
        public Object run() throws ClassNotFoundException {
      String path = name.replace('.', '/').concat(".class");
      Resource res = ucp.getResource(path, false);
      if (res != null) {
          try {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

  if (impl == null)
      return;
  // SocketImpl.connect() is a protected method, therefore we need to use
  // getDeclaredMethod, therefore we need permission to access the member
  try {
      AccessController.doPrivileged(new PrivilegedExceptionAction() {
        public Object run() throws NoSuchMethodException {
      Class[] cl = new Class[2];
      cl[0] = SocketAddress.class;
      cl[1] = Integer.TYPE;
      impl.getClass().getDeclaredMethod("connect", cl);
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    server = ((InetSocketAddress) p.address()).getHostString();
    port = ((InetSocketAddress) p.address()).getPort();
   
    // Connects to the SOCKS server
    try {
        AccessController.doPrivileged(new PrivilegedExceptionAction() {
          public Object run() throws Exception {
        cmdsock = new Socket(new PlainSocketImpl());
        cmdsock.connect(new InetSocketAddress(server, port));
        cmdIn = cmdsock.getInputStream();
        cmdOut = cmdsock.getOutputStream();
        return null;
          }
      });
    } catch (Exception e) {
        // Ooops, let's notify the ProxySelector
        sel.connectFailed(uri,p.address(),new SocketException(e.getMessage()));
        server = null;
        port = -1;
        cmdsock = null;
        savedExc = e;
        // Will continue the while loop and try the next proxy
    }
      }

      /*
       * If server is still null at this point, none of the proxy
       * worked
       */
      if (server == null || cmdsock == null) {
    throw new SocketException("Can't connect to SOCKS proxy:"
            + savedExc.getMessage());
      }
  } else {
      try {
    AccessController.doPrivileged(new PrivilegedExceptionAction() {
      public Object run() throws Exception {
          cmdsock = new Socket(new PlainSocketImpl());
          cmdsock.connect(new InetSocketAddress(server, port));
          cmdIn = cmdsock.getInputStream();
          cmdOut = cmdsock.getOutputStream();
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

        throws IOException, MissingResourceException {

        BufferedInputStream in;
        try {
            in = (BufferedInputStream)AccessController.doPrivileged(
                new PrivilegedExceptionAction() {
                    public Object run() throws Exception {
                        return new BufferedInputStream(getClass().getResourceAsStream("/sun/text/resources/" + dictionaryName));
                    }
                }
            );
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

      throw new SocketException("Socket input is shutdown");
  final Socket s = this;
  InputStream is = null;
  try {
      is = (InputStream)
    AccessController.doPrivileged(new PrivilegedExceptionAction() {
        public Object run() throws IOException {
      return impl.getInputStream();
        }
    });
  } catch (java.security.PrivilegedActionException e) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

      throw new SocketException("Socket output is shutdown");
  final Socket s = this;
  OutputStream os = null;
  try {
      os = (OutputStream)
    AccessController.doPrivileged(new PrivilegedExceptionAction() {
        public Object run() throws IOException {
      return impl.getOutputStream();
        }
    });
  } catch (java.security.PrivilegedActionException e) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

            sun.misc.Launcher l = sun.misc.Launcher.getLauncher();
      if (l != null) {
    Throwable oops = null;
    scl = l.getClassLoader();
          try {
        PrivilegedExceptionAction a;
        a = new SystemClassLoaderAction(scl);
                    scl = (ClassLoader) AccessController.doPrivileged(a);
          } catch (PrivilegedActionException pae) {
        oops = pae.getCause();
              if (oops instanceof InvocationTargetException) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

  if (impl == null)
      return;
  // DatagramSocketImpl.peekdata() is a protected method, therefore we need to use
  // getDeclaredMethod, therefore we need permission to access the member
  try {
      AccessController.doPrivileged(new PrivilegedExceptionAction() {
        public Object run() throws NoSuchMethodException {
      Class[] cl = new Class[1];
      cl[0] = DatagramPacket.class;
      impl.getClass().getDeclaredMethod("peekData", cl);
      return null;
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

        throws IOException, MissingResourceException {

        BufferedInputStream is;
        try {
            is = (BufferedInputStream)AccessController.doPrivileged(
                new PrivilegedExceptionAction() {
                    public Object run() throws Exception {
                        return new BufferedInputStream(getClass().getResourceAsStream("/sun/text/resources/" + datafile));
                    }
                }
            );
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    FileInputStream getFileInputStream(final File file)
        throws FileNotFoundException
    {
        try {
            return (FileInputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    }
                });
        } catch (PrivilegedActionException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.