Example usage for java.beans IntrospectionException getMessage

List of usage examples for java.beans IntrospectionException getMessage

Introduction

In this page you can find the example usage for java.beans IntrospectionException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.displaytag.tags.ColumnTagBeanInfo.java

/**
 * @see java.beans.BeanInfo#getPropertyDescriptors()
 *///w  w w  . j  av  a 2  s  . c o m
public PropertyDescriptor[] getPropertyDescriptors() {
    List proplist = new ArrayList();

    try {
        proplist.add(new PropertyDescriptor("autolink", //$NON-NLS-1$
                ColumnTag.class, null, "setAutolink")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("escapeXml", //$NON-NLS-1$
                ColumnTag.class, null, "setEscapeXml")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("class", //$NON-NLS-1$
                ColumnTag.class, null, "setClass")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("decorator", //$NON-NLS-1$
                ColumnTag.class, null, "setDecorator")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("group", //$NON-NLS-1$
                ColumnTag.class, null, "setGroup")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("headerClass", //$NON-NLS-1$
                ColumnTag.class, null, "setHeaderClass")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("href", //$NON-NLS-1$
                ColumnTag.class, null, "setHref")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("maxLength", //$NON-NLS-1$
                ColumnTag.class, null, "setMaxLength")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("maxWords", //$NON-NLS-1$
                ColumnTag.class, null, "setMaxWords")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("media", //$NON-NLS-1$
                ColumnTag.class, null, "setMedia")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("nulls", //$NON-NLS-1$
                ColumnTag.class, null, "setNulls")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramId", //$NON-NLS-1$
                ColumnTag.class, null, "setParamId")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramName", //$NON-NLS-1$
                ColumnTag.class, null, "setParamName")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramProperty", //$NON-NLS-1$
                ColumnTag.class, null, "setParamProperty")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramScope", //$NON-NLS-1$
                ColumnTag.class, null, "setParamScope")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("property", //$NON-NLS-1$
                ColumnTag.class, null, "setProperty")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sortable", //$NON-NLS-1$
                ColumnTag.class, null, "setSortable")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sortName", //$NON-NLS-1$
                ColumnTag.class, null, "setSortName")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("style", //$NON-NLS-1$
                ColumnTag.class, null, "setStyle")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("title", //$NON-NLS-1$
                ColumnTag.class, null, "setTitle")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("titleKey", //$NON-NLS-1$
                ColumnTag.class, null, "setTitleKey")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("url", //$NON-NLS-1$
                ColumnTag.class, null, "setUrl")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sortProperty", //$NON-NLS-1$
                ColumnTag.class, null, "setSortProperty")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("total", //$NON-NLS-1$
                ColumnTag.class, null, "setTotal")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("comparator", //$NON-NLS-1$
                ColumnTag.class, null, "setComparator")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("defaultorder", //$NON-NLS-1$
                ColumnTag.class, null, "setDefaultorder")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("headerScope", //$NON-NLS-1$
                ColumnTag.class, null, "setHeaderScope")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("scope", //$NON-NLS-1$
                ColumnTag.class, null, "setScope")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("format", //$NON-NLS-1$
                ColumnTag.class, null, "setFormat")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("value", //$NON-NLS-1$
                ColumnTag.class, null, "setValue")); //$NON-NLS-1$

        // make ATG Dynamo happy:
        proplist.add(new PropertyDescriptor("className", //$NON-NLS-1$
                ColumnTag.class, null, "setClass")); // map //$NON-NLS-1$

        // DISPL-242: handle new grouped title attribute
        proplist.add(new PropertyDescriptor("groupTitle", //$NON-NLS-1$
                ColumnTag.class, null, "setGroupTitle")); // map //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("groupTitleKey", //$NON-NLS-1$
                ColumnTag.class, null, "setGroupTitleKey")); // map //$NON-NLS-1$
    } catch (IntrospectionException ex) {
        throw new UnhandledException(
                "You got an introspection exception - maybe defining a property that is not"
                        + " defined in the ColumnTag?: " + ex.getMessage(),
                ex);
    }

    PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
    return ((PropertyDescriptor[]) proplist.toArray(result));
}

From source file:org.squidy.nodes.IEvalScreen.java

@Override
public void onStart() {
    try {/*from ww  w .  ja  va  2 s .c o  m*/
        sender = new UDPSensorSampleSenderDiscrete<S4i1b>(S4i1b.class, address, port);
        sender.start();
    } catch (IntrospectionException e) {
        if (LOG.isErrorEnabled()) {
            LOG.error(e.getMessage(), e);
        }
    } catch (SensorException e) {
        if (LOG.isErrorEnabled()) {
            LOG.error(e.getMessage(), e);
        }
    }
}

From source file:org.displaytag.tags.TableTagBeanInfo.java

/**
 * @see java.beans.BeanInfo#getPropertyDescriptors()
 *//*from w  w  w . j av  a 2 s .  co  m*/
public PropertyDescriptor[] getPropertyDescriptors() {
    List proplist = new ArrayList();

    try {
        proplist.add(new PropertyDescriptor("cellpadding", //$NON-NLS-1$
                TableTag.class, null, "setCellpadding")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("cellspacing", //$NON-NLS-1$
                TableTag.class, null, "setCellspacing")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("class", //$NON-NLS-1$
                TableTag.class, null, "setClass")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("decorator", //$NON-NLS-1$
                TableTag.class, null, "setDecorator")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("defaultorder", //$NON-NLS-1$
                TableTag.class, null, "setDefaultorder")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("defaultsort", //$NON-NLS-1$
                TableTag.class, null, "setDefaultsort")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("export", //$NON-NLS-1$
                TableTag.class, null, "setExport")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("frame", //$NON-NLS-1$
                TableTag.class, null, "setFrame")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("length", //$NON-NLS-1$
                TableTag.class, null, "setLength")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("offset", //$NON-NLS-1$
                TableTag.class, null, "setOffset")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("pagesize", //$NON-NLS-1$
                TableTag.class, null, "setPagesize")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("partialList", //$NON-NLS-1$
                TableTag.class, null, "setPartialList")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("requestURI", //$NON-NLS-1$
                TableTag.class, null, "setRequestURI")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("requestURIcontext", //$NON-NLS-1$
                TableTag.class, null, "setRequestURIcontext")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("rules", //$NON-NLS-1$
                TableTag.class, null, "setRules")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sort", //$NON-NLS-1$
                TableTag.class, null, "setSort")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("style", //$NON-NLS-1$
                TableTag.class, null, "setStyle")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("summary", //$NON-NLS-1$
                TableTag.class, null, "setSummary")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("excludedParams", //$NON-NLS-1$
                TableTag.class, null, "setExcludedParams")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("id", //$NON-NLS-1$
                TableTag.class, null, "setUid")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("uid", //$NON-NLS-1$
                TableTag.class, null, "setUid")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("htmlId", //$NON-NLS-1$
                TableTag.class, null, "setHtmlId")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("varTotals", //$NON-NLS-1$
                TableTag.class, null, "setVarTotals")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("keepStatus", //$NON-NLS-1$
                TableTag.class, null, "setKeepStatus")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("clearStatus", //$NON-NLS-1$
                TableTag.class, null, "setClearStatus")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("form", //$NON-NLS-1$
                TableTag.class, null, "setForm")); //$NON-NLS-1$

        // deprecated attributes
        proplist.add(new PropertyDescriptor("list", //$NON-NLS-1$
                TableTag.class, null, "setList")); //$NON-NLS-1$

        // 

        // Hexagon-added property, make the table non-customizable:
        proplist.add(new PropertyDescriptor("listTableName", TableTag.class, null, "setListTableName"));
        // Hexagon-added property, for screens with multiple tables, we need to know the db tableName:
        proplist.add(new PropertyDescriptor("nonConfigurable", TableTag.class, null, "setNonConfigurable"));

        // make ATG Dynamo happy:
        proplist.add(new PropertyDescriptor("className", //$NON-NLS-1$
                TableTag.class, null, "setClass")); //$NON-NLS-1$

        try {
            Class.forName("javax.servlet.jsp.tagext.IterationTag"); //$NON-NLS-1$
            // jsp >= 1.2
            proplist.add(new PropertyDescriptor("name", //$NON-NLS-1$
                    TableTag.class, null, "setName")); //$NON-NLS-1$
            proplist.add(new PropertyDescriptor("size", //$NON-NLS-1$
                    TableTag.class, null, "setSize")); //$NON-NLS-1$
        } catch (ClassNotFoundException e) {
            // jsp 1.1, can't use a setter with an Object parameter
            proplist.add(new PropertyDescriptor("name", //$NON-NLS-1$
                    TableTag.class, null, "setNameString")); //$NON-NLS-1$
            proplist.add(new PropertyDescriptor("size", //$NON-NLS-1$
                    TableTag.class, null, "setSizeObjectName")); //$NON-NLS-1$
        }

    } catch (IntrospectionException ex) {
        throw new UnhandledException(
                "You got an introspection exception - maybe defining a property that is not"
                        + " defined in the TableTag?: " + ex.getMessage(),
                ex);
    }

    PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
    return ((PropertyDescriptor[]) proplist.toArray(result));
}

From source file:com.eclecticlogic.pedal.dialect.postgresql.CopyCommand.java

private String extractColumnName(Method method, Class<? extends Serializable> clz) {
    String beanPropertyName = null;
    try {//w w  w .  j a va 2 s  . c  om
        BeanInfo info;

        info = Introspector.getBeanInfo(clz);

        for (PropertyDescriptor propDesc : info.getPropertyDescriptors()) {
            if (method.equals(propDesc.getReadMethod())) {
                beanPropertyName = propDesc.getName();
                break;
            }
        }
    } catch (IntrospectionException e) {
        throw new RuntimeException(e.getMessage(), e);
    }

    String columnName = null;
    if (clz.isAnnotationPresent(AttributeOverrides.class)) {
        for (AttributeOverride annotation : clz.getAnnotation(AttributeOverrides.class).value()) {
            if (annotation.name().equals(beanPropertyName)) {
                columnName = annotation.column().name();
                break;
            }
        }
    } else if (clz.isAnnotationPresent(AttributeOverride.class)) {
        AttributeOverride annotation = clz.getAnnotation(AttributeOverride.class);
        if (annotation.name().equals(beanPropertyName)) {
            columnName = annotation.column().name();
        }
    }
    return columnName == null ? method.getAnnotation(Column.class).name() : columnName;
}

From source file:com.icsshs.datatransfer.database.impl.QueryBeanProcessor.java

/**
 * Returns a PropertyDescriptor[] for the given Class.
 *
 * @param c The Class to retrieve PropertyDescriptors for.
 * @return A PropertyDescriptor[] describing the Class.
 * @throws SQLException if introspection failed.
 *///from   ww w .java2  s  . c  om
private PropertyDescriptor[] propertyDescriptors(Class<?> c) throws SQLException {
    // Introspector caches BeanInfo classes for better performance
    BeanInfo beanInfo = null;
    try {
        beanInfo = Introspector.getBeanInfo(c);

    } catch (IntrospectionException e) {
        throw new SQLException("Bean introspection failed: " + e.getMessage());
    }

    return beanInfo.getPropertyDescriptors();
}

From source file:org.liveSense.api.beanprocessors.DbStandardBeanProcessor.java

/**
 * Returns a PropertyDescriptor[] for the given Class.
 *
 * @param c The Class to retrieve PropertyDescriptors for.
 * @return A PropertyDescriptor[] describing the Class.
 * @throws SQLException if introspection failed.
 */// w  w w.  j a va 2s .com
private PropertyDescriptor[] propertyDescriptors(Class<?> c) throws SQLException {
    // Introspector caches BeanInfo classes for better performance
    BeanInfo beanInfo = null;
    try {
        beanInfo = Introspector.getBeanInfo(c);

    } catch (IntrospectionException e) {
        throw new SQLException("Bean introspection failed: " + e.getMessage());
    }

    //        PropertyDescriptor[] pd = beanInfo.getPropertyDescriptors();
    return beanInfo.getPropertyDescriptors();
}

From source file:com.gdcn.modules.db.jdbc.processor.CamelBeanProcessor.java

/**
 * Returns a PropertyDescriptor[] for the given Class.
 *
 * @param c The Class to retrieve PropertyDescriptors for.
 * @return A PropertyDescriptor[] describing the Class.
 * @throws SQLException if introspection failed.
 *///w  w  w . j  av a 2  s . c o m
private PropertyDescriptor[] propertyDescriptors(Class<?> c) throws SQLException {
    // Introspector caches BeanInfo classes for better performance
    BeanInfo beanInfo = null;
    try {
        beanInfo = Introspector.getBeanInfo(c);
    } catch (IntrospectionException e) {
        throw new SQLException("Bean introspection failed: " + e.getMessage());
    }
    List<PropertyDescriptor> propList = Lists.newArrayList();
    PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
    for (PropertyDescriptor prop : props) {
        String propName = prop.getName();
        try {
            Field field = ReflectionUtils.findField(c, propName);
            if (field != null && !field.isAnnotationPresent(Transient.class)) {//1.field=null 2.Transient??
                propList.add(prop);
            }
        } catch (SecurityException e) {
            throw new SQLException("Bean Get Field failed: " + e.getMessage());
        }
    }
    return propList.toArray(new PropertyDescriptor[propList.size()]);
}

From source file:com.gmail.sretof.db.jdbc.processor.CamelBeanProcessor.java

/**
 * Returns a PropertyDescriptor[] for the given Class.
 * /* w  w w .  ja va 2s  .  c  o m*/
 * @param c
 *            The Class to retrieve PropertyDescriptors for.
 * @return A PropertyDescriptor[] describing the Class.
 * @throws SQLException
 *             if introspection failed.
 */
private PropertyDescriptor[] propertyDescriptors(Class<?> c) throws SQLException {
    // Introspector caches BeanInfo classes for better performance
    BeanInfo beanInfo = null;
    try {
        beanInfo = Introspector.getBeanInfo(c);
    } catch (IntrospectionException e) {
        throw new SQLException("Bean introspection failed: " + e.getMessage());
    }
    List<PropertyDescriptor> propList = Lists.newArrayList();
    PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
    for (PropertyDescriptor prop : props) {
        String propName = prop.getName();
        try {
            Field field = ReflectionUtils.findField(c, propName);
            if (field != null && !field.isAnnotationPresent(Transient.class)) {// 1.field=null
                // 2.Transient??
                propList.add(prop);
            }
        } catch (SecurityException e) {
            throw new SQLException("Bean Get Field failed: " + e.getMessage());
        }
    }
    return propList.toArray(new PropertyDescriptor[propList.size()]);
}

From source file:com.metaparadigm.jsonrpc.BeanSerializer.java

public Object unmarshall(SerializerState state, Class clazz, Object o) throws UnmarshallException {
    JSONObject jso = (JSONObject) o;//  w ww  .  j  av  a 2s  .c  o  m
    BeanData bd = null;
    try {
        bd = getBeanData(clazz);
    } catch (IntrospectionException e) {
        throw new UnmarshallException(clazz.getName() + " is not a bean");
    }
    if (ser.isDebug())
        log.fine("instantiating " + clazz.getName());
    Object instance = null;
    try {
        instance = clazz.newInstance();
    } catch (Exception e) {
        throw new UnmarshallException("can't instantiate bean " + clazz.getName() + ": " + e.getMessage());
    }
    Object invokeArgs[] = new Object[1];
    Object fieldVal = null;
    Iterator i = jso.keys();
    while (i.hasNext()) {
        String field = (String) i.next();
        Method setMethod = (Method) bd.writableProps.get(field);
        if (setMethod != null) {
            try {
                Class param[] = setMethod.getParameterTypes();
                fieldVal = ser.unmarshall(state, param[0], jso.get(field));
            } catch (UnmarshallException e) {
                throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage());
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            if (ser.isDebug())
                log.fine("invoking " + setMethod.getName() + "(" + fieldVal + ")");
            invokeArgs[0] = fieldVal;
            try {
                setMethod.invoke(instance, invokeArgs);
            } catch (Throwable e) {
                if (e instanceof InvocationTargetException)
                    e = ((InvocationTargetException) e).getTargetException();
                throw new UnmarshallException("bean " + clazz.getName() + "can't invoke " + setMethod.getName()
                        + ": " + e.getMessage());
            }
        }
    }
    return instance;
}

From source file:net.yasion.common.core.bean.wrapper.ExtendedBeanInfo.java

/**
 * Wrap the given {@link BeanInfo} instance; copy all its existing property descriptors locally, wrapping each in a custom {@link SimpleIndexedPropertyDescriptor indexed} or {@link SimplePropertyDescriptor non-indexed} {@code PropertyDescriptor} variant that bypasses default
 * JDK weak/soft reference management; then search through its method descriptors to find any non-void returning write methods and update or create the corresponding {@link PropertyDescriptor} for each one found.
 * //  w ww. j a v  a 2 s  .  c  o m
 * @param delegate
 *            the wrapped {@code BeanInfo}, which is never modified
 * @throws IntrospectionException
 *             if any problems occur creating and adding new property descriptors
 * @see #getPropertyDescriptors()
 */
public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException {
    this.delegate = delegate;
    for (PropertyDescriptor pd : delegate.getPropertyDescriptors()) {
        try {
            this.propertyDescriptors.add(pd instanceof IndexedPropertyDescriptor
                    ? new SimpleIndexedPropertyDescriptor((IndexedPropertyDescriptor) pd)
                    : new SimplePropertyDescriptor(pd));
        } catch (IntrospectionException ex) {
            // Probably simply a method that wasn't meant to follow the JavaBeans pattern...
            if (logger.isDebugEnabled()) {
                logger.debug("Ignoring invalid bean property '" + pd.getName() + "': " + ex.getMessage());
            }
        }
    }
    MethodDescriptor[] methodDescriptors = delegate.getMethodDescriptors();
    if (methodDescriptors != null) {
        for (Method method : findCandidateWriteMethods(methodDescriptors)) {
            try {
                handleCandidateWriteMethod(method);
            } catch (IntrospectionException ex) {
                // We're only trying to find candidates, can easily ignore extra ones here...
                if (logger.isDebugEnabled()) {
                    logger.debug("Ignoring candidate write method [" + method + "]: " + ex.getMessage());
                }
            }
        }
    }
}