Package com.thoughtworks.xstream

Examples of com.thoughtworks.xstream.InitializationException


        if (annotation != null) {
            final Class<? extends ConverterMatcher> converterType = annotation.value();
            final Converter converter = cacheConverter(converterType, field.getType());
            if (converter != null) {
                if (localConversionMapper == null) {
                    throw new InitializationException("No "
                        + LocalConversionMapper.class.getName()
                        + " available");
                }
                localConversionMapper.registerLocalConverter(
                    field.getDeclaringClass(), field.getName(), converter);
View Full Code Here


                } else {
                    converter = (Converter)DependencyInjectionFactory.newInstance(
                        converterType, args, usedArgs);
                }
            } catch (final Exception e) {
                throw new InitializationException("Cannot instantiate converter "
                    + converterType.getName()
                    + (targetType != null ? " for type " + targetType.getName() : ""), e);
            }
            if (converterMapping == null) {
                converterMapping = new HashMap<Object, Converter>();
View Full Code Here

        addDefaultImplementation(Long.class, long.class);
    }

    public void addDefaultImplementation(Class defaultImplementation, Class ofType) {
        if (defaultImplementation != null && defaultImplementation.isInterface()) {
            throw new InitializationException(
                "Default implementation is not a concrete class: "
                    + defaultImplementation.getName());
        }
        typeToImpl.put(ofType, defaultImplementation);
        implToType.put(defaultImplementation, ofType);
View Full Code Here

        while (definedIn != Object.class) {
            try {
                field = definedIn.getDeclaredField(fieldName);
                break;
            } catch (SecurityException e) {
                throw new InitializationException(
                    "Access denied for field with implicit collection", e);
            } catch (NoSuchFieldException e) {
                definedIn = definedIn.getSuperclass();
            }
        }
        if (field == null) {
            throw new InitializationException("No field \""
                + fieldName
                + "\" for implicit collection");
        } else if (Map.class.isAssignableFrom(field.getType())) {
            if (itemFieldName == null && keyFieldName == null) {
                itemType = Map.Entry.class;
            }
        } else if (!Collection.class.isAssignableFrom(field.getType())) {
            Class fieldType = field.getType();
            if (!fieldType.isArray()) {
                throw new InitializationException("Field \""
                    + fieldName
                    + "\" declares no collection or array");
            } else {
                Class componentType = fieldType.getComponentType();
                componentType = componentType.isPrimitive() ? Primitives.box(componentType) : componentType;
                if (itemType == null) {
                    itemType = componentType;
                } else {
                    itemType = itemType.isPrimitive() ? Primitives.box(itemType) : itemType;
                    if (!componentType.isAssignableFrom(itemType)) {
                        throw new InitializationException("Field \""
                                + fieldName
                                + "\" declares an array, but the array type is not compatible with " + itemType.getName());
                       
                    }
                }
View Full Code Here

            .getBoolean(PreferenceConstants.SCREEN_SHOW_MOUSEPOINTER);

        try {
            this.robot = new Robot();
        } catch (AWTException e) {
            throw new InitializationException("Could not setup screengrabber",
                e);
        }
    }
View Full Code Here

                default:
                    throw new IllegalArgumentException("Unknown Mode "
                        + mode.name());
                }
            } catch (EncoderInitializationException e) {
                throw new InitializationException(
                    "Could not initialize encoder", e);
            } catch (DecoderInitializationException e) {
                throw new InitializationException(
                    "Could not initialize decoder", e);
            }
        }
View Full Code Here

            try {
                startHost();
                this.init = VideoSharingInit.create(VideoSharing.this);
                startClient();
            } catch (EncoderInitializationException e) {
                throw new InitializationException(
                    "Could not initialize encoder", e);
            } catch (DecoderInitializationException e) {
                throw new InitializationException(
                    "Could not initialize decoder", e);
            }
        }
View Full Code Here

        for (final Iterator iter = mappers.iterator(); iter.hasNext();) {
            final Class mapperType = (Class)iter.next();
            try {
                arguments[0] = DependencyInjectionFactory.newInstance(mapperType, arguments);
            } catch (Exception e) {
                throw new InitializationException("Could not instantiate mapper : "
                    + mapperType.getName(), e);
            }
        }
        return (Mapper)arguments[0];
    }
View Full Code Here

            } catch (IllegalAccessException e) {
                ex = e;
            } catch (InvocationTargetException e) {
                ex = e;
            }
            throw new InitializationException("Cannot initialize XmlFriendlyReplacer", ex);
        }
View Full Code Here

                final Converter converter = cacheConverter(converterType);
                if (converter != null) {
                    if (converterAnnotation != null || converter.canConvert(type)) {
                        converterRegistry.registerConverter(converter, XStream.PRIORITY_NORMAL);
                    } else {
                        throw new InitializationException("Converter "
                            + converterType.getName()
                            + " cannot handle annotated class "
                            + type.getName());
                    }
                }
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.InitializationException

Copyright © 2018 www.massapicom. 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.