Example usage for java.lang NoSuchMethodException getMessage

List of usage examples for java.lang NoSuchMethodException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.forms.wizard.AddExperimentEnvironmentForm.java

private void addModalWindowAndButton(MarkupContainer container, final String cookieName,
        final String buttonName, final String targetClass, final ModalWindow window) {

    AjaxButton ajaxButton = new AjaxButton(buttonName) {
        private static final long serialVersionUID = 1L;

        @Override//from w w  w.  j a v  a2 s .  c  o  m
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

            window.setCookieName(cookieName);
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = 1L;

                @Override
                public Page createPage() {
                    try {
                        Constructor<?> cons = null;
                        cons = Class.forName(targetClass).getConstructor(PageReference.class,
                                ModalWindow.class);

                        return (Page) cons.newInstance(getPage().getPageReference(), window);
                    } catch (NoSuchMethodException e) {
                        log.error(e.getMessage(), e);
                    } catch (IllegalAccessException e) {
                        log.error(e.getMessage(), e);
                    } catch (InstantiationException e) {
                        log.error(e.getMessage(), e);
                    } catch (InvocationTargetException e) {
                        log.error(e.getMessage(), e);
                    } catch (ClassNotFoundException e) {
                        log.error(e.getMessage(), e);
                    }
                    return null;
                }
            });
            window.show(target);
        }
    };
    ajaxButton.setDefaultFormProcessing(false);
    container.add(ajaxButton);
}

From source file:org.atricore.idbus.capabilities.sso.main.binding.SamlR2SoapBinding.java

public MediationMessage createMessage(CamelMediationMessage message) {

    // Get HTTP Exchange from SAML Exchange
    CamelMediationExchange samlR2exchange = message.getExchange();
    Exchange exchange = samlR2exchange.getExchange();

    logger.debug("Create Message Body from exchange " + exchange.getClass().getName());

    // Converting from CXF Message to SAMLR2 Message
    // Is this a CXF message?
    Message in = exchange.getIn();/*from w w  w .  j a  v a 2  s.c  om*/

    if (in.getBody() instanceof MessageContentsList) {

        MessageContentsList mclIn = (MessageContentsList) in.getBody();
        logger.debug("Using CXF Message Content : " + mclIn.get(0));

        MediationMessage body;
        LocalState lState = null;
        MediationState state = null;

        if (mclIn.get(0) instanceof RequestAbstractType) {
            // Process Saml Request in SOAP Channel
            // Try to restore provider state based on sessionIndex
            RequestAbstractType samlReq = (RequestAbstractType) mclIn.get(0);

            try {

                Method getSessionIndex = samlReq.getClass().getMethod("getSessionIndex");
                List<String> sessionIndexes = (List<String>) getSessionIndex.invoke(samlReq);

                if (sessionIndexes != null) {
                    if (sessionIndexes.size() > 0) {

                        String sessionIndex = sessionIndexes.get(0);

                        ProviderStateContext ctx = createProviderStateContext();

                        // Add retries just in case we're in a cluster (they are disabled in non HA setups)
                        int retryCount = getRetryCount();
                        if (retryCount > 0) {
                            lState = ctx.retrieve("idpSsoSessionId", sessionIndex, retryCount, getRetryDelay());
                        } else {
                            lState = ctx.retrieve("idpSsoSessionId", sessionIndex);
                        }

                        if (logger.isDebugEnabled())
                            logger.debug("Local state was" + (lState == null ? " NOT" : "")
                                    + " retrieved for ssoSessionId " + sessionIndex);
                    }
                }

            } catch (NoSuchMethodException e) {
                // Ignore this ...
                if (logger.isTraceEnabled())
                    logger.trace("SAML Request does not have session index : " + e.getMessage());

            } catch (InvocationTargetException e) {
                logger.error("Cannot recover local state : " + e.getMessage(), e);
            } catch (IllegalAccessException e) {
                logger.error("Cannot recover local state : " + e.getMessage(), e);
            }

        }

        if (lState == null) {
            // Create a new local state instance ?
            state = createMediationState(exchange);
        } else {
            state = new MediationStateImpl(lState);

        }

        // Process Saml Response in SOAP Channel
        body = new MediationMessageImpl(in.getMessageId(), mclIn.get(0), null, null, null, state);

        return body;

    } else {
        throw new IllegalArgumentException("Unknown message type " + in.getBody());
    }

}

From source file:com.ewcms.publication.freemarker.directive.PropertyDirective.java

@Override
@SuppressWarnings("rawtypes")
public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
        throws TemplateException, IOException {

    String propertyName = getPropertyName(env, params);
    Object objectValue = getObjectValue(env, params);

    if (EmptyUtil.isNull(propertyName)) {
        logger.error("\"name\" parameter must set");
        throw new TemplateModelException("\"name\" parameter must set");
    }//from  w w  w .jav  a 2s .  c o m

    try {
        if (EmptyUtil.isArrayNotEmpty(loopVars)) {
            Object value = loopValue(objectValue, propertyName, env, params);
            if (EmptyUtil.isNotNull(value)) {
                loopVars[0] = env.getObjectWrapper().wrap(value);
                if (EmptyUtil.isNull(body)) {
                    logger.warn("body is empty");
                } else {
                    body.render(env.getOut());
                }
            }
        } else if (EmptyUtil.isNotNull(body)) {
            Object value = loopValue(objectValue, propertyName, env, params);
            if (EmptyUtil.isNotNull(value)) {
                FreemarkerUtil.setVariable(env, defaultLoop, value);
                body.render(env.getOut());
                FreemarkerUtil.removeVariable(env, defaultLoop);
            }
        } else {
            String outValue = constructOut(objectValue, propertyName, env, params);
            if (EmptyUtil.isNotNull(outValue)) {
                Writer out = env.getOut();
                out.write(outValue.toString());
                out.flush();
            }
        }
    } catch (NoSuchMethodException e) {
        Writer out = env.getOut();
        out.write(e.toString());
        out.flush();
        throw new TemplateModelException(e.getMessage());
    }
}

From source file:io.werval.modules.qi4j.Qi4jPlugin.java

private ApplicationAssembler createApplicationAssembler(io.werval.api.Application application,
        String assembler) {//from ww w .j a  v  a2  s. c o m
    try {
        Class<?> assemblerClass = application.classLoader().loadClass(assembler);
        if (!ApplicationAssembler.class.isAssignableFrom(assemblerClass)) {
            throw new IllegalArgumentException(assembler + " is not an ApplicationAssembler.");
        }
        try {
            org.qi4j.api.structure.Application.Mode mode;
            switch (application.mode()) {
            case DEV:
                mode = org.qi4j.api.structure.Application.Mode.development;
                break;
            case TEST:
                mode = org.qi4j.api.structure.Application.Mode.test;
                break;
            case PROD:
            default:
                mode = org.qi4j.api.structure.Application.Mode.production;
                break;
            }
            return (ApplicationAssembler) assemblerClass
                    .getConstructor(org.qi4j.api.structure.Application.Mode.class).newInstance(mode);
        } catch (NoSuchMethodException ex) {
            return (ApplicationAssembler) assemblerClass.newInstance();
        }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
            | InvocationTargetException ex) {
        throw new io.werval.api.exceptions.ActivationException(ex.getMessage(), ex);
    }
}

From source file:org.photovault.swingui.color.PhotoInfoViewAdapter.java

public void setField(PhotoInfoFields field, Object newValue) {
    String propertyName = field.getName();
    try {//from  w w  w. j av a2 s.c o  m
        PropertyUtils.setProperty(this, propertyName, newValue);
    } catch (NoSuchMethodException ex) {
        log.error("Cannot set property " + propertyName);
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        log.error(ex.getMessage());
    } catch (InvocationTargetException ex) {
        log.error(ex.getMessage());
    }
}

From source file:org.photovault.swingui.color.PhotoInfoViewAdapter.java

public void setFieldMultivalued(PhotoInfoFields field, boolean isMultivalued) {
    String propertyName = field.getName() + "Multivalued";
    try {//from  w  w  w .j a v a2  s.c om
        PropertyUtils.setProperty(this, propertyName, isMultivalued);
    } catch (NoSuchMethodException ex) {
        log.error("Cannot set property " + propertyName);
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        log.error(ex.getMessage());
    } catch (InvocationTargetException ex) {
        log.error(ex.getMessage());
    }
}

From source file:org.photovault.swingui.color.PhotoInfoViewAdapter.java

public Object getField(PhotoInfoFields field) {
    Object value = null;/*from  www  .j a v a 2 s .  c  om*/
    String propertyName = field.getName();
    try {
        value = PropertyUtils.getProperty(this, propertyName);
    } catch (NoSuchMethodException ex) {
        log.error("Cannot get property " + propertyName);
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        log.error(ex.getMessage());
    } catch (InvocationTargetException ex) {
        log.error(ex.getMessage());
    }
    return value;
}

From source file:org.apache.myfaces.webapp.filter.TomahawkFacesContextWrapper.java

public void setExternalContext(ExternalContext extContext) {
    try {/*  w ww  .  j  a v a 2s  .  c  o m*/
        Method method = delegate.getClass().getMethod("setExternalContext",
                new Class[] { Class.forName("org.apache.myfaces.context.ReleaseableExternalContext") });
        method.invoke(delegate, new Object[] { extContext });
        FacesContext.setCurrentInstance(this);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException("JSF 1.2 method not implemented: " + e.getMessage());
    } catch (Exception e) {
        throw new RuntimeException("Error calling JSF 1.2 method: " + e.getMessage());
    }
}

From source file:com.funambol.admin.module.panels.DefaultSyncSourceConfigPanel.java

/**
 * Sets the SyncSource's properties with the values provided by the user.
 *///from w w w .  ja v  a 2s .co  m
private void getValues() throws AdminException {

    SyncSource syncSource = getSyncSource();

    Class c = syncSource.getClass();
    Method setSourceURI = null, setName = null, setInfo = null;
    try {

        setSourceURI = c.getMethod("setSourceURI", new Class[] { String.class });
        setName = c.getMethod("setName", new Class[] { String.class });
        setInfo = c.getMethod("setInfo", new Class[] { SyncSourceInfo.class });

    } catch (NoSuchMethodException e) {
        throw new AdminException(e.getMessage(), e);
    }

    try {
        setSourceURI.invoke(syncSource, new Object[] { sourceUriValue.getText().trim() });
        setName.invoke(syncSource, new Object[] { nameValue.getText().trim() });

        StringTokenizer types = new StringTokenizer(infoTypesValue.getText(), ",");
        StringTokenizer versions = new StringTokenizer(infoVersionsValue.getText(), ",");
        ContentType[] contentTypes = new ContentType[types.countTokens()];

        for (int i = 0; i < contentTypes.length; ++i) {
            contentTypes[i] = new ContentType(types.nextToken().trim(), versions.nextToken().trim());
        }

        setInfo.invoke(syncSource, new Object[] { new SyncSourceInfo(contentTypes, 0) });

        String transformationsRequired = null;
        if (encryption.isSelected()) {
            transformationsRequired = "des;b64";
        } else if (encoding.isSelected()) {
            transformationsRequired = "b64";
        }

        SyncSourceManagementObject mo = (SyncSourceManagementObject) getManagementObject();
        mo.setTransformationsRequired(transformationsRequired);
    } catch (IllegalAccessException e) {
        notifyError(new AdminException(e.getMessage(), e));
    } catch (InvocationTargetException e) {
        notifyError(new AdminException(e.getMessage(), e));
    }
}

From source file:org.jahia.services.content.JCRNodePropertiesELResolver.java

public Class<?> getType(ELContext elContext, Object base, Object property) {
    if (elContext == null) {
        throw new NullPointerException();
    }//from w  w w  . j a v a2s .  co  m
    if (base != null && base instanceof JCRNodeWrapper) {
        JCRNodeWrapper nodeWrapper = (JCRNodeWrapper) base;
        try {
            try {
                nodeWrapper.getClass().getMethod("get" + StringUtils.capitalize(property.toString()));
            } catch (NoSuchMethodException e) {
                if (nodeWrapper.getProperty(property.toString().replace("_", ":")) != null) {
                    elContext.setPropertyResolved(true);
                    return JCRPropertyWrapper.class;
                }
            }
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
        }
    }
    return null;
}