当前位置: 首页>>代码示例>>Java>>正文


Java AccessException类代码示例

本文整理汇总了Java中java.rmi.AccessException的典型用法代码示例。如果您正苦于以下问题:Java AccessException类的具体用法?Java AccessException怎么用?Java AccessException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AccessException类属于java.rmi包,在下文中一共展示了AccessException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * Convert a EJBException into FacesMessage which is presented to the user.
 * 
 * @param ex
 *            the EJBException to be analyzed
 */
public static void execute(EJBException ex) {
    if (ex != null && ex.getCause() instanceof Exception
            && ex.getCausedByException() instanceof AccessException) {
        handleOrganizationAuthoritiesException();
    } else if (ex != null && isInvalidUserSession(ex)) {
        HttpServletRequest request = JSFUtils.getRequest();
        request.getSession().removeAttribute(Constants.SESS_ATTR_USER);
        request.getSession().invalidate();
        handleInvalidSession();
    } else if (ex != null && isConnectionException(ex)) {
        handleMissingConnect(BaseBean.ERROR_DATABASE_NOT_AVAILABLE);
    } else {
        throw new FacesException(ex);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:22,代码来源:ExceptionHandler.java

示例2: handleServletException

import java.rmi.AccessException; //导入依赖的package包/类
private void handleServletException(HttpServletRequest httpRequest,
        HttpServletResponse httpResponse, ServletException e)
        throws IOException, ServletException {
    EJBException ejbEx = ExceptionHandler.getEJBException(e);
    if (ejbEx != null && ejbEx.getCause() instanceof Exception
            && ejbEx.getCausedByException() instanceof AccessException) {
        String forwardErrorPage;
        if (BesServletRequestReader.isMarketplaceRequest(httpRequest)) {
            forwardErrorPage = Marketplace.MARKETPLACE_ROOT
                    + Constants.INSUFFICIENT_AUTHORITIES_URI;
        } else {
            forwardErrorPage = Constants.INSUFFICIENT_AUTHORITIES_URI;
        }
        JSFUtils.sendRedirect(httpResponse,
                httpRequest.getContextPath() + forwardErrorPage);
    } else {
        // make sure we do not catch exceptions cause by
        // ViewExpiredException here, they'll be handled directly in the
        // doFilter()
        throw e;
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:AuthorizationFilter.java

示例3: shutdown

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    RegistryImpl.checkAccess("ActivationSystem.shutdown");

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Activation.java

示例4: shutdown

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:Activation.java

示例5: assertIsAccessException

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:NonLocalActivationTest.java

示例6: assertIsAccessException

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int rrIndex = msg.indexOf("Registry.Registry");     // Obsolete error text
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                rrIndex != -1 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:NonLocalRegistryTest.java

示例7: assertIsAccessException

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:NonLocalJMXRemoteTest.java

示例8: unbind

import java.rmi.AccessException; //导入依赖的package包/类
/** @inheritDoc */
public void unbind(String name) throws RemoteException, NotBoundException,
    AccessException
{
  if (name.equals(Main.STOP))
    {
      if (bindings instanceof Persistent)
        ((Persistent) bindings).writeContent();
       // Terminate in 10 seconds.
       System.out.println("Shutdown command received. Will terminate in 10 s");
       Persistent.timer.schedule(new Persistent.ExitTask(), 10000);
    }
  else
    {
      if (Main.verbose)
        System.out.println("Unbind "+name);

      if (!bindings.containsKey(name))
        throw new NotBoundException(name);
      else
        bindings.remove(name);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:24,代码来源:RegistryImpl.java

示例9: handleServletException

import java.rmi.AccessException; //导入依赖的package包/类
private void handleServletException(HttpServletRequest httpRequest,
        HttpServletResponse httpResponse, ServletException e)
        throws IOException, ServletException {
    EJBException ejbEx = ExceptionHandler.getEJBException(e);
    if (ejbEx != null && ejbEx.getCause() instanceof Exception
            && ejbEx.getCausedByException() instanceof AccessException) {
        String forwardErrorPage;
        if (BesServletRequestReader.isMarketplaceRequest(httpRequest)) {
            forwardErrorPage = Marketplace.MARKETPLACE_ROOT
                    + Constants.INSUFFICIENT_AUTHORITIES_URI;
        } else {
            forwardErrorPage = Constants.INSUFFICIENT_AUTHORITIES_URI;
        }
        JSFUtils.sendRedirect(httpResponse, httpRequest.getContextPath()
                + forwardErrorPage);
    } else {
        // make sure we do not catch exceptions cause by
        // ViewExpiredException here, they'll be handled directly in the
        // doFilter()
        throw e;
    }
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:23,代码来源:AuthorizationFilter.java

示例10: unbind

import java.rmi.AccessException; //导入依赖的package包/类
/** @inheritDoc */
public void unbind(String name) throws RemoteException, NotBoundException,
    AccessException
{
  if (name.equals(Main.STOP))
    {
      if (bindings instanceof Persistent)
        ((Persistent) bindings).writeContent();
       // Terminate in 10 seconds.
       System.out.println("Shutdown command received. Will terminate in 10 s");
       Persistent.timer.schedule(new Persistent.ExitTask(), 10000);
    }
  else
    {
      if (Main.verbose)
        System.out.println("Unbind "+name);
      
      if (!bindings.containsKey(name))
        throw new NotBoundException(name);
      else
        bindings.remove(name);
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:24,代码来源:RegistryImpl.java

示例11: takeCharge

import java.rmi.AccessException; //导入依赖的package包/类
@Override
public void takeCharge(String fileName, List<ReplicaLoc> slaveReplicas) throws AccessException, RemoteException, NotBoundException {
	System.out.println("[@Replica] taking charge of file: "+fileName);
	System.out.println(slaveReplicas);
	
	List<ReplicaReplicaInterface> slaveReplicasStubs = new ArrayList<ReplicaReplicaInterface>(slaveReplicas.size());
	
	for (ReplicaLoc loc : slaveReplicas) {
		// if the current locations is this replica .. ignore
		if (loc.getId() == this.id)
			continue;
		  
		// if this is a new replica generate stub for this replica
		if (!replicaServersLoc.containsKey(loc.getId())){
			replicaServersLoc.put(loc.getId(), loc);
			ReplicaReplicaInterface stub = (ReplicaReplicaInterface) registry.lookup("ReplicaClient"+loc.getId());
			replicaServersStubs.put(loc.getId(), stub);
		}
		ReplicaReplicaInterface replicaStub = replicaServersStubs.get(loc.getId());
		slaveReplicasStubs.add(replicaStub);
	}
	
	filesReplicaMap.put(fileName, slaveReplicasStubs);
}
 
开发者ID:leonardo7,项目名称:RMI-based-DFS,代码行数:25,代码来源:ReplicaServer.java

示例12: testProviderMethodWithSubclassOfExceptionIsOk

import java.rmi.AccessException; //导入依赖的package包/类
public void testProviderMethodWithSubclassOfExceptionIsOk() {
  providesInjector = Guice.createInjector(new AbstractModule() {
    protected void configure() {
      install(ThrowingProviderBinder.forModule(this));
    }
    
    @SuppressWarnings("unused")
    @CheckedProvides(RemoteProvider.class)
    String foo() throws AccessException {
      throw new AccessException("boo!");
    }
  });
  
  RemoteProvider<String> remoteProvider = 
    providesInjector.getInstance(Key.get(remoteProviderOfString));

  try {
    remoteProvider.get();
    fail();
  } catch (RemoteException expected) {
    assertTrue(expected instanceof AccessException);
    assertEquals("boo!", expected.getMessage());
  }
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:25,代码来源:ThrowingProviderTest.java

示例13: bind

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * @see Registry.bind(String, Remote)
 */
public void bind(String name, Remote obj)
        throws RemoteException, AlreadyBoundException, AccessException {
    if (name == null) {
        // rmi.5D=name could not be null.
        throw new NullPointerException(Messages.getString("rmi.5D")); //$NON-NLS-1$
    }

    if (obj == null) {
        // rmi.5C=obj could not be null.
        throw new NullPointerException(Messages.getString("rmi.5C")); //$NON-NLS-1$
    }

    if (table.containsKey(name)) {
        // rmi.5E=There is already binding to the name {0}.
        throw new AlreadyBoundException(Messages.getString("rmi.5E", name)); //$NON-NLS-1$
    }
    checkAccess("RegistryImpl.bind"); //$NON-NLS-1$
    table.put(name, obj);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:RegistryImpl.java

示例14: lookup

import java.rmi.AccessException; //导入依赖的package包/类
/**
 * @see Registry.lookup(String)
 */
public Remote lookup(String name)
        throws RemoteException, NotBoundException, AccessException {
    if (name == null) {
        // rmi.5D=name could not be null.
        throw new NullPointerException(Messages.getString("rmi.5D")); //$NON-NLS-1$
    }
    Remote ref = (Remote) table.get(name);

    if (ref == null) {
        // rmi.5F=Name {0} is not associated with any remote reference.
        throw new NotBoundException(Messages.getString("rmi.5F", name)); //$NON-NLS-1$

    }
    return ref;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:RegistryImpl.java

示例15: testCxtorWithSubclassOfExceptionIsOk

import java.rmi.AccessException; //导入依赖的package包/类
public void testCxtorWithSubclassOfExceptionIsOk() throws Exception {
  cxtorInjector = Guice.createInjector(new AbstractModule() {
      @Override
      protected void configure() {
        ThrowingProviderBinder.create(binder())
            .bind(RemoteProvider.class, Foo.class)
            .providing(SubclassExceptionFoo.class);
      }
    });
  
  RemoteProvider<Foo> remoteProvider = 
      cxtorInjector.getInstance(Key.get(remoteProviderOfFoo));

    try {
      remoteProvider.get();
      fail();
    } catch (RemoteException expected) {
      assertTrue(expected instanceof AccessException);
      assertEquals("boo!", expected.getMessage());
    }
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:22,代码来源:CheckedProviderTest.java


注:本文中的java.rmi.AccessException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。