List of usage examples for java.security PrivilegedActionException getException
public Exception getException()
From source file:org.wso2.carbon.user.core.common.AbstractUserStoreManager.java
public final void updateRoleListOfUser(final String roleName, final String[] deletedUsers, final String[] newRoles) throws UserStoreException { try {/*from www. j a v a2 s. com*/ AccessController.doPrivileged(new PrivilegedExceptionAction<String>() { @Override public String run() throws Exception { updateRoleListOfUserInternal(roleName, deletedUsers, newRoles); return null; } }); } catch (PrivilegedActionException e) { throw (UserStoreException) e.getException(); } }
From source file:org.wso2.carbon.user.core.common.AbstractUserStoreManager.java
protected boolean authenticate(final String userName, final Object credential, final boolean domainProvided) throws UserStoreException { try {/*from w w w . j ava 2 s .c o m*/ return AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() throws Exception { return authenticateInternal(userName, credential, domainProvided); } }); } catch (PrivilegedActionException e) { throw (UserStoreException) e.getException(); } }
From source file:org.wso2.carbon.user.core.common.AbstractUserStoreManager.java
/** * {@inheritDoc}/*from w w w . ja va2 s .c om*/ */ public final boolean authenticate(final String userName, final Object credential) throws UserStoreException { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() throws Exception { if (userName == null || credential == null) { log.error("Authentication failure. Either Username or Password is null"); return false; } int index = userName != null ? userName.indexOf(CarbonConstants.DOMAIN_SEPARATOR) : -1; boolean domainProvided = index > 0; return authenticate(userName, credential, domainProvided); } }); } catch (PrivilegedActionException e) { throw (UserStoreException) e.getException(); } }
From source file:org.apache.openjpa.enhance.PCEnhancer.java
/** * Return the method of the given owner type matching the given criteria. * * @param type the type of state being passed * @param prefix the prefix of the method to call; all methods * end in '[state type]Field'; only the prefix varies * @param get true if receiving information from the * owner, false if passing it to the owner * @param haspc true if the pc is passed as an extra argument * @param curValue true if the current state value is passed to * the owner as an extra argument/* w w w . j av a 2 s.co m*/ */ private Method getMethod(Class owner, Class type, String prefix, boolean get, boolean haspc, boolean curValue) throws NoSuchMethodException { // all methods end in [field type]Field, where the field type // can be any of the primitve types (but capitalized), 'String', // or 'Object'; figure out what type to use String typeName = type.getName(); if (type.isPrimitive()) typeName = typeName.substring(0, 1).toUpperCase(Locale.ENGLISH) + typeName.substring(1); else if (type.equals(String.class)) typeName = "String"; else { typeName = "Object"; type = Object.class; } // the field index is always passed as an arg; the pc instance and // the current value may be passed; if setting the new value is // also passed List plist = new ArrayList(4); if (haspc) plist.add(PCTYPE); plist.add(int.class); if (!get || curValue) plist.add(type); if (!get && curValue) { plist.add(type); plist.add(int.class); } // use reflection to return the right method String name = prefix + typeName + "Field"; Class[] params = (Class[]) plist.toArray(new Class[plist.size()]); try { return AccessController.doPrivileged(J2DoPrivHelper.getDeclaredMethodAction(owner, name, params)); } catch (PrivilegedActionException pae) { throw (NoSuchMethodException) pae.getException(); } }
From source file:org.apache.openjpa.enhance.PCEnhancer.java
/** * Adds the 'stock' methods to the bytecode; these include methods * like {@link PersistenceCapable#pcFetchObjectId} * and {@link PersistenceCapable#pcIsTransactional}. *//*from w w w.ja va2 s.c o m*/ private void addStockMethods() throws NoSuchMethodException { try { // pcGetGenericContext translateFromStateManagerMethod( AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "get" + CONTEXTNAME, (Class[]) null)), false); // pcFetchObjectId translateFromStateManagerMethod( AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "fetchObjectId", (Class[]) null)), false); // pcIsDeleted translateFromStateManagerMethod(AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "isDeleted", (Class[]) null)), false); // pcIsDirty translateFromStateManagerMethod(AccessController .doPrivileged(J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "isDirty", (Class[]) null)), true); // pcIsNew translateFromStateManagerMethod(AccessController .doPrivileged(J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "isNew", (Class[]) null)), false); // pcIsPersistent translateFromStateManagerMethod(AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "isPersistent", (Class[]) null)), false); // pcIsTransactional translateFromStateManagerMethod( AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "isTransactional", (Class[]) null)), false); // pcSerializing translateFromStateManagerMethod(AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "serializing", (Class[]) null)), false); // pcDirty translateFromStateManagerMethod( AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(SMTYPE, "dirty", new Class[] { String.class })), false); // pcGetStateManager BCMethod meth = _pc.declareMethod(PRE + "GetStateManager", StateManager.class, null); Code code = meth.getCode(true); loadManagedInstance(code, false); code.getfield().setField(SM, StateManager.class); code.areturn(); code.calculateMaxStack(); code.calculateMaxLocals(); } catch (PrivilegedActionException pae) { throw (NoSuchMethodException) pae.getException(); } }