Search in sources :

Example 1 with NotEmpty

use of org.omg.CosNaming.NamingContextPackage.NotEmpty in project wildfly by wildfly.

the class CorbaNamingContext method destroy.

public void destroy() throws NotEmpty {
    if (this.destroyed)
        return;
    if (!this.names.isEmpty() || !this.contexts.isEmpty())
        throw new NotEmpty();
    else {
        this.names = null;
        this.contexts = null;
        this.destroyed = true;
    }
}
Also used : NotEmpty(org.omg.CosNaming.NamingContextPackage.NotEmpty)

Example 2 with NotEmpty

use of org.omg.CosNaming.NamingContextPackage.NotEmpty in project wildfly by wildfly.

the class ExceptionMapper method mapException.

public static NamingException mapException(Exception e, CNCtx ctx, NameComponent[] inputName) throws NamingException {
    if (e instanceof NamingException) {
        return (NamingException) e;
    }
    if (e instanceof RuntimeException) {
        throw (RuntimeException) e;
    }
    NamingException ne;
    if (e instanceof NotFound) {
        if (ctx.federation) {
            return tryFed((NotFound) e, ctx, inputName);
        } else {
            ne = new NameNotFoundException();
        }
    } else if (e instanceof CannotProceed) {
        ne = new CannotProceedException();
        NamingContext nc = ((CannotProceed) e).cxt;
        NameComponent[] rest = ((CannotProceed) e).rest_of_name;
        // NotFound doesn't set rest as expected. -RL
        if (inputName != null && (inputName.length > rest.length)) {
            NameComponent[] resolvedName = new NameComponent[inputName.length - rest.length];
            System.arraycopy(inputName, 0, resolvedName, 0, resolvedName.length);
            // Wrap resolved NamingContext inside a CNCtx
            // Guess that its name (which is relative to ctx)
            // is the part of inputName minus rest_of_name
            ne.setResolvedObj(new CNCtx(ctx._orb, nc, ctx._env, ctx.makeFullName(resolvedName)));
        } else {
            ne.setResolvedObj(ctx);
        }
        ne.setRemainingName(org.wildfly.iiop.openjdk.naming.jndi.CNNameParser.cosNameToName(rest));
    } else if (e instanceof InvalidName) {
        ne = new InvalidNameException();
    } else if (e instanceof AlreadyBound) {
        ne = new NameAlreadyBoundException();
    } else if (e instanceof NotEmpty) {
        ne = new ContextNotEmptyException();
    } else {
        ne = new NamingException();
    }
    ne.setRootCause(e);
    return ne;
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) CannotProceed(org.omg.CosNaming.NamingContextPackage.CannotProceed) NamingContext(org.omg.CosNaming.NamingContext) NameAlreadyBoundException(javax.naming.NameAlreadyBoundException) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) InvalidNameException(javax.naming.InvalidNameException) CannotProceedException(javax.naming.CannotProceedException) ContextNotEmptyException(javax.naming.ContextNotEmptyException) NamingException(javax.naming.NamingException) AlreadyBound(org.omg.CosNaming.NamingContextPackage.AlreadyBound) NotEmpty(org.omg.CosNaming.NamingContextPackage.NotEmpty) NotFound(org.omg.CosNaming.NamingContextPackage.NotFound)

Aggregations

NotEmpty (org.omg.CosNaming.NamingContextPackage.NotEmpty)2 CannotProceedException (javax.naming.CannotProceedException)1 ContextNotEmptyException (javax.naming.ContextNotEmptyException)1 InvalidNameException (javax.naming.InvalidNameException)1 NameAlreadyBoundException (javax.naming.NameAlreadyBoundException)1 NameNotFoundException (javax.naming.NameNotFoundException)1 NamingException (javax.naming.NamingException)1 NamingContext (org.omg.CosNaming.NamingContext)1 AlreadyBound (org.omg.CosNaming.NamingContextPackage.AlreadyBound)1 CannotProceed (org.omg.CosNaming.NamingContextPackage.CannotProceed)1 InvalidName (org.omg.CosNaming.NamingContextPackage.InvalidName)1 NotFound (org.omg.CosNaming.NamingContextPackage.NotFound)1