Package com.cedarsolutions.exception

Examples of com.cedarsolutions.exception.InvalidDataException


        }
    }

    /** Generate a JAXB unmarshal exception due to validation problems. */
    private static <T> InvalidDataException generateValidationError(Class<T> type, ValidationEventCollector eventHandler) {
        InvalidDataException invalid = getUnmarshalError(type, null);

        invalid.getDetails().addMessage(ERROR_KEY, "Found validation errors");
        for (ValidationEvent event : eventHandler.getEvents()) {
            invalid.getDetails().addMessage(ERROR_KEY, event.getMessage());
        }
        return invalid;
    }
View Full Code Here


    }

    /** Translate a JAXB unmarshal exception into something legible. */
    private static <T> InvalidDataException translateJaxbUnmarshalError(Class<T> type, JAXBException e) {
        boolean added = false;
        InvalidDataException invalid = getUnmarshalError(type, e);

        // This was developed through trial-and-error.  I don't know how well it will hold up in the future.
        if (e.getCause() != null && e.getLinkedException() != null) {
            try {
                throw e.getLinkedException();
            } catch (org.xml.sax.SAXParseException sax) {
                String message = "Line " + sax.getLineNumber() + ", column " + sax.getColumnNumber() + ": " + e.getCause().getMessage();
                invalid.getDetails().addMessage(ERROR_KEY, message);
                added = true;
            } catch (Throwable other) { }
        }

        if (!added && e.getCause() != null && e.getCause().getMessage() != null) {
            invalid.getDetails().addMessage(ERROR_KEY, e.getCause().getMessage());
            added = true;
        }

        if (!added && e.getMessage() != null) {
            invalid.getDetails().addMessage(ERROR_KEY, e.getMessage());
            added = true;
        }

        return invalid;
    }
View Full Code Here

            FileInputStream stream = null;
            try {
                stream = new FileInputStream(path);
                properties.load(stream);
            } catch (Exception e) {
                throw new InvalidDataException("Properties could not be loaded: " + e.getMessage(), e);
            } finally {
                if (stream != null) {
                    try {
                        stream.close();
                    } catch (Exception e) { }
View Full Code Here

                                return cookie;
                            } else {
                                cookieToReturn = cookie;
                            }
                        } else {
                            throw new InvalidDataException("Duplicate cookie [" + cookieName + "]: possible cookie override attack?");
                        }
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.cedarsolutions.exception.InvalidDataException

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.