Package java.security

Examples of java.security.PrivilegedExceptionAction


    verifyDenied(action, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_OWNER);
  }

  @Test
  public void testCloseRegion() throws Exception {
    PrivilegedExceptionAction action = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        ACCESS_CONTROLLER.preClose(ObserverContext.createAndPrepare(RCP_ENV, null), false);
        return null;
      }
    };
View Full Code Here


  }


  @Test
  public void testSnapshot() throws Exception {
    PrivilegedExceptionAction snapshotAction = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        ACCESS_CONTROLLER.preSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
          null, null);
        return null;
      }
    };

    PrivilegedExceptionAction deleteAction = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        ACCESS_CONTROLLER.preDeleteSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
          null);
        return null;
      }
    };

    PrivilegedExceptionAction restoreAction = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        ACCESS_CONTROLLER.preRestoreSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
          null, null);
        return null;
      }
    };

    PrivilegedExceptionAction cloneAction = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        ACCESS_CONTROLLER.preCloneSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
          null, null);
        return null;
      }
View Full Code Here

                    String encodedURI = null;
                    final String frelativePath = relativePath;
                    if (SecurityUtil.isPackageProtectionEnabled() ){
                        try{
                            encodedURI = (String)AccessController.doPrivileged(
                                new PrivilegedExceptionAction(){                               
                                    public Object run() throws IOException{
                                        return urlEncoder.encodeURL(frelativePath);
                                    }
                           });  
                        } catch (PrivilegedActionException pae){
View Full Code Here

        {
            Constructor  serverConstructor;
            try
            {
                serverConstructor = (Constructor) AccessController.doPrivileged(
            new PrivilegedExceptionAction() {
              public Object run() throws NoSuchMethodException, SecurityException
              {
                if (listenAddress == null)
                  return serverClass.getConstructor(null);
                else
View Full Code Here

        if (file == null) {
            throw new IllegalArgumentException("file cannot be <null>");
        }
        try {
            return ((Boolean)AccessController.doPrivileged(
                        new PrivilegedExceptionAction() {
                            public Object run() throws SecurityException {
                                return new Boolean(file.exists());
                            }
                        })).booleanValue();
        } catch (PrivilegedActionException pae) {
View Full Code Here

        if (file == null) {
            throw new IllegalArgumentException("file cannot be <null>");
        }
        try {
            return ((Boolean)AccessController.doPrivileged(
                        new PrivilegedExceptionAction() {
                            public Object run() throws SecurityException {
                                return new Boolean(file.isDirectory());
                            }
                        })).booleanValue();
        } catch (PrivilegedActionException pae) {
View Full Code Here

        if (directory == null) {
            throw new IllegalArgumentException("file cannot be <null>");
        }
        try {
            return (String[])AccessController.doPrivileged(
                        new PrivilegedExceptionAction() {
                            public Object run() throws SecurityException {
                                return directory.list();
                            }
                        });
        } catch (PrivilegedActionException pae) {
View Full Code Here

    }
    // Open a server socket listener   
    try{
      serverSocket =
        (ServerSocket)
        AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws IOException
            {
              return createServerSocket();
            }
          });
    } catch (PrivilegedActionException e) {
      Exception e1 = e.getException();

      // Test for UnknownHostException first since it's a
      // subbclass of IOException (and consolePropertyMessage
      // throws an exception when the severity is S (or U).
      if (e1 instanceof UnknownHostException) {
        consolePropertyMessage("DRDA_UnknownHost.S", hostArg);
      } else if (e1 instanceof IOException) {
        consolePropertyMessage("DRDA_ListenPort.S",
                     new String [] {
                       Integer.toString(portNumber),
                       hostArg,
                       // Since SocketException
                       // is used for a phletora
                       // of situations, we need
                       // to communicate the
                       // underlying exception
                       // string to the user.
                       e1.toString()});
      } else {
        throw e1;
      }
    } catch (Exception e) {
    // If we find other (unexpected) errors, we ultimately exit--so make
    // sure we print the error message before doing so (Beetle 5033).
      throwUnexpectedException(e);
    }

    switch (getSSLMode()) {
    default:
    case SSL_OFF:
      consolePropertyMessage("DRDA_Ready.I", new String []
        {Integer.toString(portNumber), att_srvclsnm, versionString,
         getFormattedTimestamp()});
      break;
    case SSL_BASIC:
      consolePropertyMessage("DRDA_SSLReady.I", new String []
        {Integer.toString(portNumber), att_srvclsnm, versionString,
         getFormattedTimestamp()});
      break;
    case SSL_PEER_AUTHENTICATION:
      consolePropertyMessage("DRDA_SSLClientAuthReady.I", new String []
        {Integer.toString(portNumber), att_srvclsnm, versionString,
         getFormattedTimestamp()});
      break;
    }
   
    // We accept clients on a separate thread so we don't run into a problem
    // blocking on the accept when trying to process a shutdown
    final ClientThread clientThread =  
      (ClientThread) AccessController.doPrivileged(
                new PrivilegedExceptionAction() {
                  public Object run() throws Exception
                  {
                    return new ClientThread(thisControl,
                                serverSocket);
                  }
View Full Code Here

  private void setUpSocket() throws Exception
  {
   
    try {
      clientSocket = (Socket) AccessController.doPrivileged(
                new PrivilegedExceptionAction() {
                   
                  public Object run()
                    throws UnknownHostException,
                         IOException,
                         java.security.NoSuchAlgorithmException,
View Full Code Here

  private ProductVersionHolder getNetProductVersionHolder() throws Exception
  {
    ProductVersionHolder myPVH= null;
    try {
      myPVH = (ProductVersionHolder) AccessController.doPrivileged(
                new PrivilegedExceptionAction() {
                   
                  public Object run() throws UnknownHostException,IOException
                  {
                    InputStream versionStream = getClass().getResourceAsStream(ProductGenusNames.NET_INFO);
View Full Code Here

TOP

Related Classes of java.security.PrivilegedExceptionAction

Copyright © 2018 www.massapicom. 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.