Examples of DatabindingException


Examples of org.apache.cxf.aegis.DatabindingException

                    List<Object> p = CastUtils.cast((List<?>)property);
                    l.addAll(p);
                    return;
                }
                if (m == null) {
                    throw new DatabindingException("No write method for property " + name + " in "
                                                   + object.getClass());
                }
            }

            Class propertyType = desc.getPropertyType();
            if ((property == null && !propertyType.isPrimitive()) || (property != null)) {
                m.invoke(object, new Object[] {
                    property
                });
            }
        } catch (Exception e) {
            if (e instanceof DatabindingException) {
                throw (DatabindingException)e;
            }

            throw new DatabindingException("Couldn't set property " + name + " on " + object + ". "
                                           + e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

            Object value = readProperty(object, name);
            if (value != null) {
                AegisType type = getType(inf, name);

                if (type == null) {
                    throw new DatabindingException("Couldn't find type for " + value.getClass()
                                                   + " for property " + name);
                }

                MessageWriter cwriter = writer.getAttributeWriter(name);

                type.writeObject(value, cwriter, context);

                cwriter.close();
            }
        }
       
        if (inf.isExtension()) {
            AegisType t = getSuperType();
            if (t != null) {
                t.writeObject(object, writer, context);
            }
        }

        for (QName name : inf.getElements()) {

            if (inf.isExtension()
                && inf.getPropertyDescriptorFromMappedName(name).getReadMethod().getDeclaringClass() != inf
                    .getTypeClass()) {
                continue;
            }
            Object value = readProperty(object, name);

            AegisType defaultType = getType(inf, name);
            AegisType type = TypeUtil.getWriteType(context.getGlobalContext(), value, defaultType);

            // Write the value if it is not null.
            if (value != null) {
                if (type == null) {
                    throw new DatabindingException("Couldn't find type for " + value.getClass()
                                                   + " for property " + name);
                }

                writeElement(name, value, type, writer, context);
            } else if (inf.isNillable(name)) {
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

            PropertyDescriptor desc = getTypeInfo().getPropertyDescriptorFromMappedName(name);

            Method m = desc.getReadMethod();

            if (m == null) {
                throw new DatabindingException("No read method for property " + name + " in class "
                                               + object.getClass().getName());
            }

            return m.invoke(object, new Object[0]);
        } catch (Exception e) {
            throw new DatabindingException("Couldn't get property " + name + " from bean " + object, e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

    }

    @Override
    public void setTypeClass(Type typeClass) {
        if (!(typeClass instanceof Class)) {
            throw new DatabindingException("Aegis cannot map generic Enums.");
        }
       
        Class<?> plainClass = (Class<?>)typeClass;
        if (!plainClass.isEnum()) {
            throw new DatabindingException("EnumType must map an enum.");
        }

        super.setTypeClass(typeClass);
    }
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

            return null;
        }
        if (AegisType.class.isAssignableFrom(c)) {
            return c.asSubclass(AegisType.class);
        } else {
            throw new DatabindingException("Invalid Aegis type annotation to non-type class" + c);
        }
    }
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

        }

        MessageReader typeReader = reader.getAttributeReader(XSI_TYPE);

        if (null == typeReader && !readToDocument) {
            throw new DatabindingException("Missing 'xsi:type' attribute");
        }

        String typeName = typeReader.getValue();

        if (null == typeName && !readToDocument) {
            throw new DatabindingException("Missing 'xsi:type' attribute value");
        }

        AegisType type = null;
        QName typeQName = null;
       
        if (typeName != null) {
            typeName = typeName.trim();
            typeQName = extractQName(reader, typeName);
        } else {
            typeQName = reader.getName();
        }

        TypeMapping tm = context.getTypeMapping();
        if (tm == null) {
            tm = getTypeMapping();
        }

        type = tm.getType(typeQName);

        if (type == null) {
            type = tm.getType(getSchemaType());
        }

        if (type == this) {
            throw new DatabindingException("Could not determine how to read type: " + typeQName);
        }
       
        if (type == null && readToDocument) {
            type = getTypeMapping().getType(Document.class);
        }

        if (null == type) {
            // TODO should check namespace as well..
            if (serializedWhenUnknown && "serializedJavaObject".equals(typeName)) {
                return reconstituteJavaObject(reader);
            }

            throw new DatabindingException("No mapped type for '" + typeName + "' (" + typeQName + ")");
        }

        return type.readObject(reader, context);
    }
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

        try {
            ByteArrayInputStream in = new ByteArrayInputStream(Base64Utility
                                                                   .decode(reader.getValue().trim()));
            return new ObjectInputStream(in).readObject();
        } catch (Exception e) {
            throw new DatabindingException("Unable to reconstitute serialized object", e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

                String typeName = (String)it.next();
                Class c;
                try {
                    c = ClassLoaderUtils.loadClass(typeName, TypeUtil.class);
                } catch (ClassNotFoundException e) {
                    throw new DatabindingException("Could not find override type class: " + typeName, e);
                }

                Type t = tm.getType(c);
                if (t == null) {
                    t = tm.getTypeCreator().createType(c);
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

                hasChildren = false;
                if (root.hasNext()) {
                    root.next();
                }
            } catch (XMLStreamException e) {
                throw new DatabindingException("Could not read XML stream.", e);
            }
           
            if (value == null) {
                value = "";
            } else {
View Full Code Here

Examples of org.apache.cxf.aegis.DatabindingException

            hasCheckedChildren = true;
            hasChildren = false;
            return false;
        } catch (XMLStreamException e) {
            throw new DatabindingException("Error parsing document.", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.