Example usage for java.lang IllegalAccessException getMessage

List of usage examples for java.lang IllegalAccessException getMessage

Introduction

In this page you can find the example usage for java.lang IllegalAccessException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:de.fiz.ddb.aas.utils.LDAPEngineUtilityOrganisation.java

protected boolean licensedOganizationExists(String orgId) throws ExecutionException {
    NamingEnumeration<SearchResult> searchResults = null;
    try {/*w  w  w. j  a va2  s  . c o  m*/
        searchResults = this.query(LDAPConnector.getSingletonInstance().getLicensedInstitutionsBaseDN(),
                new StringBuilder("(& (objectclass=").append(Constants.ldap_ddbOrg_ObjectClass).append(") (")
                        .append(Constants.ldap_ddbOrg_Id).append("=").append(orgId).append("))").toString(),
                new String[] { Constants.ldap_ddbOrg_Id, "+" }, SearchControls.SUBTREE_SCOPE);
        if (searchResults.hasMore()) {
            return true;
        } else {
            return false;
        }
    } catch (IllegalAccessException ex) {
        LOG.log(Level.SEVERE, "Connection-Error", ex);
        throw new ExecutionException(ex.getMessage(), ex.getCause());
    } catch (NamingException ne) {
        LOG.log(Level.SEVERE, "something went wrong while checking if userId exists", ne);
        throw new ExecutionException(ne.getMessage(), ne.getCause());
    } finally {
        if (searchResults != null) {
            try {
                searchResults.close();
            } catch (NamingException e) {
            }
        }
    }
}

From source file:de.fiz.ddb.aas.utils.LDAPEngineUtilityOrganisation.java

public Set<OIDs> getAllSubOrgIds(boolean pLicensedOrgs, OIDs pOIDs, int pScopy, AasPrincipal pPerformer)
        throws ExecutionException {
    Set<OIDs> vSetOIDs = new HashSet<OIDs>();
    NamingEnumeration<SearchResult> searchResults = null;
    try {//from   ww w. ja v  a  2  s.c  o m
        searchResults = getAllSubOrgs(pLicensedOrgs, pOIDs, pScopy,
                new String[] { Constants.ldap_ddbOrg_Id, Constants.ldap_ddbOrg_PID, "+" }, pPerformer);
        SearchResult sr;
        Attribute attr;
        while (searchResults.hasMore()) {
            sr = searchResults.next();
            if ((attr = sr.getAttributes().get(Constants.ldap_ddb_EntryDN)) != null) {
                vSetOIDs.add(new OIDs(String.valueOf(attr.get()),
                        (attr = sr.getAttributes().get(Constants.ldap_ddbOrg_PID)) != null
                                ? String.valueOf(attr.get())
                                : null));
            } else {
                throw new ExecutionException("entryDN = null : OIDs = " + pOIDs, null);
            }
        }
    } catch (IllegalAccessException ex) {
        LOG.log(Level.SEVERE, "Connection-Error", ex);
        throw new ExecutionException(ex.getMessage(), ex.getCause());
    } catch (NamingException ne) {
        LOG.log(Level.SEVERE, "NamingException", ne);
        throw new ExecutionException(ne.getMessage(), ne.getCause());
    } finally {
        if (searchResults != null) {
            try {
                searchResults.close();
                searchResults = null;
            } catch (NamingException ex) {
            }
        }
    }
    return vSetOIDs;
}

From source file:de.fiz.ddb.aas.utils.LDAPEngineUtilityOrganisation.java

public NamingEnumeration<SearchResult> getAllSubOrgs(boolean pLicensedOrgs, OIDs pOIDs, int pScopy,
        String[] attributeFilter, AasPrincipal pPerformer) throws ExecutionException {
    if (pPerformer == null) {
        throw new IllegalArgumentException("The contractor is unknown: Performer == null");
    }//from w  w  w  . ja v a 2s .  c om
    if (attributeFilter == null) {
        attributeFilter = new String[] { "*", "+" };
    }

    String orgRdn = pOIDs.getOrgRDN();
    if (StringUtils.isEmpty(orgRdn)) {
        orgRdn = getOrgRdnForOrgId(pOIDs, pPerformer);
    }

    if (orgRdn == null) {
        throw new ExecutionException("OrgRDN = null", null);
    }
    InitialLdapContext ctx = null;
    try {
        ctx = LDAPConnector.getSingletonInstance().takeCtx();
        StringBuilder vBaseDn = new StringBuilder(Constants.ldap_ddbOrg_Id).append("=")
                .append(orgRdn.replaceAll(",", "," + Constants.ldap_ddbOrg_Id + "=")).append(",")
                .append((!pLicensedOrgs ? LDAPConnector.getSingletonInstance().getInstitutionBaseDN()
                        : LDAPConnector.getSingletonInstance().getLicensedInstitutionsBaseDN()));
        StringBuilder vFilter = new StringBuilder("(objectClass=").append(Constants.ldap_ddbOrg_ObjectClass)
                .append(")");
        NamingEnumeration<SearchResult> searchResults = this.query(ctx, vBaseDn.toString(), vFilter.toString(),
                attributeFilter, pScopy);
        return searchResults;
    } catch (IllegalAccessException ex) {
        LOG.log(Level.SEVERE, "Connection-Error", ex);
        throw new ExecutionException(ex.getMessage(), ex.getCause());
    } catch (NamingException ne) {
        LOG.log(Level.SEVERE, "NamingException", ne);
        throw new ExecutionException(ne.getMessage(), ne.getCause());
    } finally {
        if (ctx != null) {
            try {
                LDAPConnector.getSingletonInstance().putCtx(ctx);
            } catch (Exception ex) {
                LOG.log(Level.SEVERE, "Exception", ex);
            }
        }
    }
}

From source file:net.shopxx.entity.Goods.java

@Transient
public String getAttributeValue(Attribute attribute) {
    if (attribute == null || attribute.getPropertyIndex() == null) {
        return null;
    }/*from   w ww. ja va  2 s. c  om*/

    try {
        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + attribute.getPropertyIndex();
        return (String) PropertyUtils.getProperty(this, propertyName);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:net.shopxx.entity.Goods.java

@Transient
public void setAttributeValue(Attribute attribute, String attributeValue) {
    if (attribute == null || attribute.getPropertyIndex() == null) {
        return;/*w  ww .  j  a v a2 s. c  o  m*/
    }

    try {
        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + attribute.getPropertyIndex();
        PropertyUtils.setProperty(this, propertyName, attributeValue);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:net.shopxx.entity.Goods.java

@Transient
public void removeAttributeValue() {
    for (int i = 0; i < ATTRIBUTE_VALUE_PROPERTY_COUNT; i++) {
        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + i;
        try {//  w w  w  .j a  v  a2  s  .c  o m
            PropertyUtils.setProperty(this, propertyName, null);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage(), e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}

From source file:org.semispace.SemiSpace.java

/**
 * Protected for the benefit of junit test(s)
 * /* www .  j ava 2s .c  o m*/
 * @param examine Non-null object
 * /
protected Map<String, Object> retrievePropertiesFromObject(ISemiSpaceTuple examine) {
Map<String, Object> map = examine.getSearchMap();
      fillMapWithPublicFields(examine);
addGettersToMap(examine, map);
        
//        if ( examine instanceof InternalQuery ) {
//            map.put(SemiSpace.ADMIN_GROUP_IS_FLAGGED, "true");
//        }
// Need to rename class entry in order to separate on class elements.
String tag = (String)map.remove("tag"); //TODO ????
map.put("tag", tag );
return map;
}
        
/**
 * Add an objects getter names and values in a map. Note that all values are converted to strings.
 */
private void addGettersToMap(ISemiSpaceTuple examine, Map<String, Object> map) {
    final Set<String> getters = new HashSet<String>();
    final Method[] methods = examine.getClass().getMethods();
    final Map<String, Method> keyedMethod = new HashMap<String, Method>();
    final Map<String, String> keyedMethodName = new HashMap<String, String>();
    for (Method method : methods) {
        final String name = method.getName();
        final int parameterLength = method.getTypeParameters().length;
        if (parameterLength == 0 && name.startsWith("get")) {
            // Equalize key to [get][set][X]xx
            String normalized = name.substring(3, 4).toLowerCase() + name.substring(4);
            getters.add(normalized);
            keyedMethod.put(name, method);
            keyedMethodName.put(normalized, name);
            //log.info("Got name "+name+" which was normalized to "+normalized);
        }
    }
    for (String name : getters) {
        try {
            Object value = keyedMethod.get(keyedMethodName.get(name)).invoke(examine, null);
            //log.info(">> want to insert "+name+"="+value);
            if (value != null) {
                map.put(name, "" + value);
            }
        } catch (IllegalAccessException e) {
            log.logError("Could not access method g" + name + ". Got (masked exception) " + e.getMessage(), e);
        } catch (InvocationTargetException e) {
            log.logError("Could not access method g" + name + ". Got (masked exception) " + e.getMessage(), e);
        }
    }
}

From source file:org.squale.squalix.tools.compiling.java.parser.wsad.JWSADParser.java

/**
 * Sert  parser des block du manifest qui ont la mme DTD pBlock: string1, string2, string3 (par exemple les
 * parties Bundle-Required et Export-Package)
 * /*w w  w  .j  a v  a  2 s. c o  m*/
 * @param pProject le projet
 * @param pManifest le manifest
 * @param pBlock le block  trouver
 * @param pMethod la mthode  appeler pour chaque ligne trouve
 * @throws ConfigurationException si erreur
 */
private void parseManifest(JWSADProject pProject, File pManifest, String pBlock, Method pMethod)
        throws ConfigurationException {
    try {
        // On rcupre toutes les valeurs (commence par un espace et se termine par un espace)
        BufferedReader reader = new BufferedReader(new FileReader(pManifest));
        String line = reader.readLine();
        String plugin = "";

        while (null != line && !line.startsWith(pBlock)) {
            // on parse jusqu' trouver la partie qui nous intresse
            line = reader.readLine();
        }
        if (null != line) {
            boolean stop = !line.endsWith(",");
            // On rcupre chaque plugin du Require-Bundle
            line = line.replaceFirst(pBlock + ": ", "");
            String[] plugins = line.split(",");
            for (int i = 0; i < plugins.length; i++) {
                pMethod.invoke(this, new Object[] { pProject, plugins[i].trim() });
            }
            line = reader.readLine();
            while (null != line && !stop) {
                if (line.endsWith(",")) {
                    plugins = line.split(",");
                    for (int i = 0; i < plugins.length; i++) {
                        pMethod.invoke(this, new Object[] { pProject, plugins[i].trim() });
                    }
                } else {
                    stop = true;
                    pMethod.invoke(this, new Object[] { pProject, line.trim() });
                }
                line = reader.readLine();
            }
        }
    } catch (IOException ioe) {
        throw new ConfigurationException(ioe.getMessage());
    } catch (InvocationTargetException ite) {
        throw new ConfigurationException(ite.getTargetException().getMessage());
    } catch (IllegalAccessException iae) {
        throw new ConfigurationException(iae.getMessage());
    }

}

From source file:com.jaspersoft.jasperserver.api.metadata.user.service.impl.ObjectPermissionServiceImpl.java

/**
 * Constructs an individual <code>BasicAclEntry</code> from the passed
 * <code>ObjectPermission</code> and <code>InternalURI</code>.
 *
 * <P>//w  ww  . j a  v a 2  s  . c o m
 * Guarantees to never return <code>null</code> (exceptions are thrown in
 * the event of any issues).
 * </p>
 *
 * @param propertiesInformation mandatory information about which instance
 *        to create, the object identity, and the parent object identity
 *        (<code>null</code> or empty <code>String</code>s prohibited for
 *        <code>aclClass</code> and <code>aclObjectIdentity</code>
 * @param aclInformation optional information about the individual ACL
 *        record (if <code>null</code> only an "inheritence marker"
 *        instance is returned; if not <code>null</code>, it is prohibited
 *        to present <code>null</code> or an empty <code>String</code> for
 *        <code>recipient</code>)
 *
 * @return a fully populated instance suitable for use by external objects
 *
 * @throws IllegalArgumentException if the indicated ACL class could not be
 *         created
 */
BasicAclEntry createBasicAclEntry(String targetURI, ObjectPermission aclInformation) {
    BasicAclEntry entry;

    try {
        entry = (BasicAclEntry) SimpleAclEntry.class.newInstance();
    } catch (InstantiationException ie) {
        throw new IllegalArgumentException(ie.getMessage());
    } catch (IllegalAccessException iae) {
        throw new IllegalArgumentException(iae.getMessage());
    }

    entry.setAclObjectIdentity(new URIObjectIdentity(targetURI));
    entry.setAclObjectParentIdentity(new URIObjectIdentity(getParentURI(targetURI)));

    if (aclInformation == null) {
        // this is an inheritance marker instance only
        entry.setMask(0);
        entry.setRecipient(RECIPIENT_USED_FOR_INHERITANCE_MARKER);
    } else {
        // this is an individual ACL entry
        entry.setMask(aclInformation.getPermissionMask());
        entry.setRecipient(aclInformation.getPermissionRecipient());
    }

    return entry;
}