Example usage for java.security PrivilegedActionException getMessage

List of usage examples for java.security PrivilegedActionException getMessage

Introduction

In this page you can find the example usage for java.security PrivilegedActionException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:at.irian.myfaces.wscope.renderkit.html.WsServerSideStateCacheImpl.java

protected Object deserializeView(Object state) {
    if (log.isLoggable(Level.FINEST)) {
        log.finest("Entering deserializeView");
    }//from   w w  w . java  2s.c  o m

    if (state instanceof byte[]) {
        if (log.isLoggable(Level.FINEST)) {
            log.finest("Processing deserializeView - deserializing serialized state. Bytes : "
                    + ((byte[]) state).length);
        }

        try {
            ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) state);
            InputStream is = bais;
            if (is.read() == COMPRESSED_FLAG) {
                is = new GZIPInputStream(is);
            }
            ObjectInputStream ois = null;
            try {
                final ObjectInputStream in = new MyFacesObjectInputStream(is);
                ois = in;
                Object object = null;
                if (System.getSecurityManager() != null) {
                    object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                        public Object run()
                                throws PrivilegedActionException, IOException, ClassNotFoundException {
                            //return new Object[] {in.readObject(), in.readObject()};
                            return in.readObject();
                        }
                    });
                } else {
                    //object = new Object[] {in.readObject(), in.readObject()};
                    object = in.readObject();
                }
                return object;
            } finally {
                if (ois != null) {
                    ois.close();
                    ois = null;
                }
            }
        } catch (PrivilegedActionException e) {
            log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(),
                    e);
            return null;
        } catch (IOException e) {
            log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(),
                    e);
            return null;
        } catch (ClassNotFoundException e) {
            log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(),
                    e);
            return null;
        }
    } else if (state instanceof Object[]) {
        if (log.isLoggable(Level.FINEST)) {
            log.finest("Exiting deserializeView - state not serialized.");
        }

        return state;
    } else if (state == null) {
        log.severe("Exiting deserializeView - this method should not be called with a null-state.");
        return null;
    } else {
        log.severe("Exiting deserializeView - this method should not be called with a state of type : "
                + state.getClass());
        return null;
    }
}

From source file:org.apache.axis2.deployment.AxisConfigBuilder.java

/**
 * Processes AxisObservers.//ww  w.  jav  a2s . c o  m
 *
 * @param oservers
 */
private void processObservers(Iterator oservers) {
    while (oservers.hasNext()) {
        try {
            OMElement observerelement = (OMElement) oservers.next();
            AxisObserver observer;
            OMAttribute trsClas = observerelement.getAttribute(new QName(TAG_CLASS_NAME));
            if (trsClas == null) {
                log.info(Messages.getMessage(DeploymentErrorMsgs.OBSERVER_ERROR));
                return;
            }
            final String clasName = trsClas.getAttributeValue();

            Class observerclass;
            try {
                observerclass = (Class) org.apache.axis2.java.security.AccessController
                        .doPrivileged(new PrivilegedExceptionAction() {
                            public Object run() throws ClassNotFoundException {
                                return Loader.loadClass(clasName);
                            }
                        });
            } catch (PrivilegedActionException e) {
                throw (ClassNotFoundException) e.getException();
            }
            observer = (AxisObserver) observerclass.newInstance();
            // processing Parameters
            // Processing service level parameters
            Iterator itr = observerelement.getChildrenWithName(new QName(TAG_PARAMETER));
            processParameters(itr, observer, axisConfig);
            // initialization
            try {
                observer.init(axisConfig);
            } catch (Throwable e) {
                //Observer init may throw runtime exception , but we can stil
                // start Axis2
                log.info(e.getMessage());
            }
            axisConfig.addObservers(observer);
        } catch (Exception e) {
            log.info(e.getMessage());
        }
    }
}

From source file:org.apache.axis2.deployment.ModuleBuilder.java

private void loadModuleClass(AxisModule module, String moduleClassName) throws DeploymentException {
    Class moduleClass;/*from w  w  w .  ja  va2  s  .co  m*/

    try {
        if ((moduleClassName != null) && !"".equals(moduleClassName)) {
            moduleClass = Loader.loadClass(module.getModuleClassLoader(), moduleClassName);
            final Class fmoduleClass = moduleClass;
            final AxisModule fmodule = module;
            try {
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws IllegalAccessException, InstantiationException {
                        Module new_module = (Module) fmoduleClass.newInstance();
                        fmodule.setModule(new_module);
                        return null;
                    }
                });
            } catch (PrivilegedActionException e) {
                throw e.getException();
            }
        }
    } catch (Exception e) {
        throw new DeploymentException(e.getMessage(), e);
    }
}

From source file:org.apache.axis2.jaxws.description.builder.DescriptionBuilderUtils.java

/**
 * Return the class for this name/*from w w  w  . ja  v  a  2  s. c o  m*/
 *
 * @return Class
 */
private static Class forName(final String className, final boolean initialize, final ClassLoader classloader)
        throws ClassNotFoundException {
    Class cl = null;
    try {
        cl = (Class) AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws ClassNotFoundException {
                return Class.forName(className, initialize, classloader);
            }
        });
    } catch (PrivilegedActionException e) {
        if (log.isDebugEnabled()) {
            log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
        }
        throw (ClassNotFoundException) e.getException();
    }

    return cl;
}

From source file:org.apache.axis2.jaxws.description.builder.DescriptionBuilderUtils.java

/**
 * Return the class for this name//from w ww. j  av  a  2  s. co m
 *
 * @return Class
 */
private static Class forName(final String className) throws ClassNotFoundException {
    Class cl = null;
    try {
        cl = (Class) AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws ClassNotFoundException {
                return Class.forName(className);
            }
        });
    } catch (PrivilegedActionException e) {
        if (log.isDebugEnabled()) {
            log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
        }
        throw (ClassNotFoundException) e.getException();
    }

    return cl;
}

From source file:org.apache.axis2.jaxws.description.builder.DescriptionBuilderUtils.java

/**
 * @return ClassLoader/*from  ww w  .  ja v  a2s .  c o  m*/
 */
private static ClassLoader getContextClassLoader(final ClassLoader classLoader) {
    ClassLoader cl;
    try {
        cl = (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws ClassNotFoundException {
                return classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader();
            }
        });
    } catch (PrivilegedActionException e) {
        if (log.isDebugEnabled()) {
            log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
        }
        throw ExceptionFactory.makeWebServiceException(e.getException());
    }

    return cl;
}

From source file:org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.java

private static ClassLoader getContextClassLoader(final ClassLoader classLoader) {
    ClassLoader cl;/*  w  ww. j  a  va2  s . co  m*/
    try {
        cl = (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws ClassNotFoundException {
                return classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader();
            }
        });
    } catch (PrivilegedActionException e) {
        if (log.isDebugEnabled()) {
            log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
        }
        throw ExceptionFactory.makeWebServiceException(e.getException());
    }

    return cl;
}

From source file:org.apache.axis2.jaxws.util.ClassLoaderUtils.java

/**
 * @return ClassLoader//from w w  w .  ja v  a  2 s  .com
 */
public static ClassLoader getContextClassLoader(final ClassLoader classLoader) {
    ClassLoader cl;
    try {
        cl = (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws ClassNotFoundException {
                return classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader();
            }
        });
    } catch (PrivilegedActionException e) {
        if (log.isDebugEnabled()) {
            log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
        }
        throw ExceptionFactory.makeWebServiceException(e.getException());
    }

    return cl;
}

From source file:org.apache.axis2.jaxws.util.ClassLoaderUtils.java

/**
 * Return the class for this name//from   ww  w.j a  v  a2s .c  om
 *
 * @return Class
 */
public static Class forName(final String className, final boolean initialize, final ClassLoader classloader)
        throws ClassNotFoundException {
    Class cl = null;
    try {
        cl = (Class) AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws ClassNotFoundException {
                return Class.forName(className, initialize, classloader);
            }
        });
    } catch (PrivilegedActionException e) {
        if (log.isDebugEnabled()) {
            log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
        }
        throw (ClassNotFoundException) e.getException();
    }

    return cl;
}

From source file:org.apache.axis2.jaxws.util.ClassLoaderUtils.java

/**
 * Return the class for this name//from  w  ww .  j  a  va 2s  .  c  om
 *
 * @return Class
 */
public static Class forName(final String className) throws ClassNotFoundException {
    Class cl = null;
    try {
        cl = (Class) AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws ClassNotFoundException {
                return Class.forName(className);
            }
        });
    } catch (PrivilegedActionException e) {
        if (log.isDebugEnabled()) {
            log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
        }
        throw (ClassNotFoundException) e.getException();
    }

    return cl;
}