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:org.seasar.struts.action.S2RequestProcessor.java

@Override
protected ActionForm processActionForm(HttpServletRequest request, HttpServletResponse response,
        ActionMapping mapping) {/*from  www.  j  a  va 2  s . c  o  m*/

    String name = mapping.getName();
    if (name == null) {
        return null;
    }
    FormBeanConfig formConfig = moduleConfig.findFormBeanConfig(name);
    if (formConfig == null) {
        return null;
    }
    ActionForm actionForm = ActionFormUtil.getActionForm(request, mapping);
    if (actionForm != null) {
        return actionForm;
    }
    try {
        actionForm = formConfig.createActionForm(servlet);
    } catch (IllegalAccessException e) {
        log.error(e.getMessage(), e);
        throw new RuntimeException(e);
    } catch (InstantiationException e) {
        log.error(e.getMessage(), e);
        throw new RuntimeException(e);
    }
    if ("request".equals(mapping.getScope())) {
        request.setAttribute(mapping.getAttribute(), actionForm);
    } else {
        HttpSession session = request.getSession();
        session.setAttribute(mapping.getAttribute(), actionForm);
    }
    return actionForm;

}

From source file:gov.nih.nci.caarray.web.action.ArrayDesignAction.java

@SuppressWarnings("PMD.ExcessiveMethodLength")
private void saveImportFile() {
    try {/*from  w  w w  .j a v  a 2  s .  co m*/
        // figure out if we are editing or creating.
        if (this.arrayDesign.getId() != null
                && (this.uploadFileName == null || this.uploadFileName.isEmpty())) {
            ServiceLocatorFactory.getArrayDesignService().saveArrayDesign(this.arrayDesign);
        } else {
            handleFiles();
        }
    } catch (final RuntimeException re) {
        if (re.getCause() instanceof InvalidNumberOfArgsException) {
            final InvalidNumberOfArgsException inv = (InvalidNumberOfArgsException) re.getCause();
            addFieldError(UPLOAD_FIELD_NAME, getText("arrayDesign.error." + inv.getMessage(),
                    inv.getArguments().toArray(new String[inv.getArguments().size()])));
        } else {
            addFieldError(UPLOAD_FIELD_NAME, getText("arrayDesign.error.importingFile"));
        }
        this.arrayDesign.getDesignFiles().clear();
    } catch (final InvalidDataFileException e) {
        LOG.debug("Swallowed exception saving array design file", e);
        final FileValidationResult result = e.getFileValidationResult();
        for (final ValidationMessage message : result.getMessages()) {
            addFieldError(UPLOAD_FIELD_NAME, message.getMessage());
        }
        this.arrayDesign.getDesignFiles().clear();
    } catch (final IllegalAccessException iae) {
        LOG.debug("Swallowed exception saving array design file", iae);
        this.arrayDesign = ServiceLocatorFactory.getArrayDesignService()
                .getArrayDesign(this.arrayDesign.getId());
        addActionError(iae.getMessage());
    } catch (final Exception e) {
        LOG.debug("Swallowed exception saving array design file", e);
        if (this.arrayDesign.getId() != null) {
            this.arrayDesign = ServiceLocatorFactory.getArrayDesignService()
                    .getArrayDesign(this.arrayDesign.getId());
        }
        addFieldError(UPLOAD_FIELD_NAME, getText("arrayDesign.error.importingFile"));
    } finally {
        // delete any files created as part of the unzipping process.
        // if the file uploaded was not a zip it will also be deleted
        if (this.uploads != null) {
            for (final File f : this.uploads) {
                f.delete();
            }
        }
    }
}

From source file:er.directtoweb.pages.ERD2WListPage.java

/**
 * Attempts to instantiate the custom edit object delegate subclass, if one has been specified.
 *///from  ww  w.j  av  a2 s .com
private ERDEditObjectDelegate editObjectDelegateInstance() {
    ERDEditObjectDelegate delegate = null;
    String delegateClassName = (String) d2wContext().valueForKey("editObjectDelegateClass");
    if (delegateClassName != null) {
        try {
            Class delegateClass = Class.forName(delegateClassName);
            Constructor delegateClassConstructor = delegateClass.getConstructor(WOContext.class);
            delegate = (ERDEditObjectDelegate) delegateClassConstructor.newInstance(context());
        } catch (LinkageError le) {
            if (le instanceof ExceptionInInitializerError) {
                log.warn("Could not initialize edit object delegate class: " + delegateClassName);
            } else {
                log.warn(
                        "Could not load  delegate class: " + delegateClassName + " due to: " + le.getMessage());
            }
        } catch (ClassNotFoundException cnfe) {
            log.warn("Could not find class for edit object delegate: " + delegateClassName);
        } catch (NoSuchMethodException nsme) {
            log.warn("Could not find constructor for edit object delegate class: " + delegateClassName);
        } catch (SecurityException se) {
            log.warn(
                    "Insufficient privileges to access edit object delegate constructor: " + delegateClassName);
        } catch (IllegalAccessException iae) {
            log.warn("Insufficient access to create edit object delegate instance: " + iae.getMessage());
        } catch (IllegalArgumentException iae) {
            log.warn("Used an illegal argument when creating edit object delegate instance: "
                    + iae.getMessage());
        } catch (InstantiationException ie) {
            log.warn("Could not instantiate edit object delegate instance: " + ie.getMessage());
        } catch (InvocationTargetException ite) {
            log.warn("Exception while invoking edit object delegate constructor: " + ite.getMessage());
        }
    }

    return delegate;
}

From source file:org.cloudifysource.restclient.GSRestClient.java

@SuppressWarnings("unchecked")
public List<ControllerDetails> getManagers() throws ErrorStatusException {
    Object retval = get("service/controllers");
    List<Object> list = (List<Object>) retval;
    List<ControllerDetails> result = new ArrayList<ControllerDetails>(list.size());
    for (Object object : list) {
        Map<String, Object> map = (Map<String, Object>) object;
        ControllerDetails details = new ControllerDetails();
        try {/*from www .j a va 2  s  .co  m*/
            BeanUtils.populate(details, map);
        } catch (IllegalAccessException e) {
            throw new IllegalStateException("Error while reading response from server: " + e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new IllegalStateException("Error while reading response from server: " + e.getMessage(), e);
        }
        result.add(details);

    }

    return result;

}

From source file:org.cloudifysource.restclient.GSRestClient.java

@SuppressWarnings("unchecked")
public List<ControllerDetails> shutdownManagers() throws ErrorStatusException {
    Object retval = delete("service/controllers", null);

    List<Object> list = (List<Object>) retval;
    List<ControllerDetails> result = new ArrayList<ControllerDetails>(list.size());
    for (Object object : list) {
        Map<String, Object> map = (Map<String, Object>) object;
        ControllerDetails details = new ControllerDetails();
        try {//from w  w w. j ava 2  s . com
            BeanUtils.populate(details, map);
        } catch (IllegalAccessException e) {
            throw new IllegalStateException("Error while reading response from server: " + e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new IllegalStateException("Error while reading response from server: " + e.getMessage(), e);
        }
        result.add(details);

    }

    return result;
}

From source file:stc.app.bean.lang.ReflectionToStringBuilder.java

/**
 * <p>/*from  w w  w  .  j ava  2 s .c o m*/
 * Appends the fields and values defined by the given object of the given Class.
 * </p>
 * 
 * <p>
 * If a cycle is detected as an object is &quot;toString()'ed&quot;, such an object is rendered as
 * if <code>Object.toString()</code> had been called and not implemented by the object.
 * </p>
 * 
 * @param clazz The class of object parameter
 */
protected void appendFieldsIn(Class clazz) {
    if (clazz.isArray()) {
        this.reflectionAppendArray(this.getObject());
        return;
    }
    Field[] fields = clazz.getDeclaredFields();
    AccessibleObject.setAccessible(fields, true);
    for (int i = 0; i < fields.length; i++) {
        Field field = fields[i];
        String fieldName = field.getName();
        if (this.accept(field)) {
            try {
                // Warning: Field.get(Object) creates wrappers objects
                // for primitive types.
                Object fieldValue = this.getValue(field);
                this.append(fieldName, fieldValue);
            } catch (IllegalAccessException ex) {
                // this can't happen. Would get a Security exception
                // instead
                // throw a runtime exception in case the impossible
                // happens.
                throw new InternalError("Unexpected IllegalAccessException: " + ex.getMessage());
            }
        }
    }
}

From source file:com.netflix.zuul.scriptManager.FilterScriptManagerServlet.java

private void handleUploadAction(HttpServletRequest request, HttpServletResponse response) throws IOException {

    String filter = handlePostBody(request, response);

    if (filter != null) {
        FilterInfo filterInfo = null;/*from  w  ww  .  j av  a2 s  . c o  m*/
        try {
            filterInfo = FilterVerifier.getInstance().verifyFilter(filter);
        } catch (IllegalAccessException e) {
            logger.error(e.getMessage(), e);
            setUsageError(500, "ERROR: Unable to process uploaded data. " + e.getMessage(), response);
        } catch (InstantiationException e) {
            logger.error(e.getMessage(), e);
            setUsageError(500, "ERROR: Bad Filter. " + e.getMessage(), response);
        }
        filterInfo = scriptDAO.addFilter(filter, filterInfo.getFilterType(), filterInfo.getFilterName(),
                filterInfo.getFilterDisablePropertyName(), filterInfo.getFilterOrder());
        if (filterInfo == null) {
            setUsageError(500, "ERROR: Unable to process uploaded data.", response);
            return;
        }
        response.sendRedirect("filterLoader.jsp");

        //            Map<String, Object> scriptJson = createEndpointScriptJSON(filterInfo);
        //            response.getWriter().write(JsonUtility.jsonFromMap(scriptJson));
    }
}

From source file:org.josso.tooling.gshell.install.installer.VFSInstaller.java

/**
 * //  TODO : This could be a in a super class.
 * Prototype pattern.//from  ww  w . ja  va2 s  . co  m
 *
 * @return
 */
public Installer createInstaller() throws InstallException {
    try {

        VFSInstaller newInstaller = getClass().newInstance();

        newInstaller.setPrinter(printer);
        newInstaller.setTargetPlatform(new VariableSolverPlatform(targetPlatform, newInstaller));
        newInstaller.appCtx = appCtx;
        newInstaller.copied = true;

        return newInstaller;

    } catch (IllegalAccessException e) {
        throw new InstallException(e.getMessage(), e);
    } catch (InstantiationException e) {
        throw new InstallException(e.getMessage(), e);
    }
}

From source file:org.springframework.data.mongodb.core.convert.MappingMongoConverter.java

private <S extends Object> S read(final MongoPersistentEntity<S> entity, final DBObject dbo) {

    final StandardEvaluationContext spelCtx = new StandardEvaluationContext(dbo);
    spelCtx.addPropertyAccessor(DBObjectPropertyAccessor.INSTANCE);

    if (applicationContext != null) {
        spelCtx.setBeanResolver(new BeanFactoryResolver(applicationContext));
    }//from   w  ww  . ja v a 2 s  .c  om

    final MappedConstructor constructor = new MappedConstructor(entity, mappingContext);

    SpELAwareParameterValueProvider delegate = new SpELAwareParameterValueProvider(spelExpressionParser,
            spelCtx);
    ParameterValueProvider provider = new DelegatingParameterValueProvider(constructor, dbo, delegate);

    final BeanWrapper<MongoPersistentEntity<S>, S> wrapper = BeanWrapper.create(entity, provider,
            conversionService);

    // Set properties not already set in the constructor
    entity.doWithProperties(new PropertyHandler<MongoPersistentProperty>() {
        public void doWithPersistentProperty(MongoPersistentProperty prop) {

            boolean isConstructorProperty = constructor.isConstructorParameter(prop);
            boolean hasValueForProperty = dbo.containsField(prop.getFieldName());

            if (!hasValueForProperty || isConstructorProperty) {
                return;
            }

            Object obj = getValueInternal(prop, dbo, spelCtx, prop.getSpelExpression());
            wrapper.setProperty(prop, obj, useFieldAccessOnly);
        }
    });

    // Handle associations
    entity.doWithAssociations(new AssociationHandler<MongoPersistentProperty>() {
        public void doWithAssociation(Association<MongoPersistentProperty> association) {
            MongoPersistentProperty inverseProp = association.getInverse();
            Object obj = getValueInternal(inverseProp, dbo, spelCtx, inverseProp.getSpelExpression());
            try {
                wrapper.setProperty(inverseProp, obj);
            } catch (IllegalAccessException e) {
                throw new MappingException(e.getMessage(), e);
            } catch (InvocationTargetException e) {
                throw new MappingException(e.getMessage(), e);
            }
        }
    });

    return wrapper.getBean();
}

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

protected boolean organizationExists(String orgId) throws ExecutionException {
    NamingEnumeration<SearchResult> searchResults = null;
    try {/*from   w w w  .j av a 2s  .c om*/
        searchResults = this.query(LDAPConnector.getSingletonInstance().getInstitutionBaseDN(),
                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) {
            }
        }
    }
}