Package org.impalaframework.exception

Examples of org.impalaframework.exception.ExecutionException


        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = null;
        try {
            docBuilder = factory.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            throw new ExecutionException("Error in parser configuration", e);
        }
        Document doc = docBuilder.newDocument();
        return doc;
    }
View Full Code Here


            Source source = new DOMSource(document);
            Result result = new StreamResult(writer);
            Transformer xformer = TransformerFactory.newInstance().newTransformer();
            xformer.transform(source, result);
          } catch (Exception e) {
            throw new ExecutionException("Failed outputting XML document", e);
          }

    }
View Full Code Here

            InputSource inputSource = new InputSource(reader);
            document = loader.loadDocument(inputSource, null, new SimpleSaxErrorHandler(logger),
                    XmlBeanDefinitionReader.VALIDATION_NONE, true);
        }
        catch (Exception e) {
            throw new ExecutionException("Unable to load XML document from resource " + description, e);
        }
        finally {
            try {
                if (reader != null) {
                    reader.close();
View Full Code Here

            Resource xsdResource) {
       
        Assert.notNull(xsdResource, "xsdResource cannot be null");
       
        if (!xsdResource.exists()) {
            throw new ExecutionException("Cannot validate document as xsdResource '" + xsdResource + "' does not exist");
        } else {
          if (logger.isDebugEnabled()) {
            logger.debug("Validating using schema resource " + xsdResource.getDescription());
          }
        }
       
        SchemaFactory factory =
            SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
   
        try {
            InputStream inputStream = xsdResource.getInputStream();
            Source source = new StreamSource(inputStream);
   
            Schema schema = factory.newSchema(source);
            Validator validator = schema.newValidator();
            validator.validate(new DOMSource(document));
        }
        catch (SAXParseException e) {
            throw new ExecutionException("Error on " + e.getLineNumber() + ", column " + e.getColumnNumber() + " in " + description + ": " + e.getMessage(), e);
        }
        catch (SAXException e) {
            throw new ExecutionException("Error parsing " + description + ": " + e.getMessage(), e);
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        for (int i = 0; i < files.length; i++) {
            try {
                files[i] = resources[i].getFile();
            }
            catch (IOException e) {
                throw new ExecutionException("Unable to convert " + resources[i].getDescription() + " into a File", e);
            }
        }
        return files;
    }
View Full Code Here

        InputStreamReader reader = null;
        try {
            reader = new InputStreamReader(resource.getInputStream(), "UTF8");
        }
        catch (Exception e) {
            throw new ExecutionException("Unable to read resource " + resource.getDescription(), e);
        }
        return reader;
    }
View Full Code Here

        try {
            reader = getReaderForResource(resource);
            return FileCopyUtils.copyToString(reader);
        }
        catch (Exception e) {
            throw new ExecutionException("Unable to read resource " + resource.getDescription(), e);
        }
        finally {
            if (reader != null) {
                try {
                    reader.close();
View Full Code Here

        try {
            Properties props = (Properties) factoryBean.getObject();
            properties = props;
        } catch (IOException e) {
            if (properties != null) {
                throw new ExecutionException("Unable to load properties from " + factoryBean, e);
            }
        }
    }
View Full Code Here

   
     @SuppressWarnings("unchecked")
    public static <T extends Object> T cast(final Object o, Class<T> clazz) {
        if (o == null) return null;
        if (!(clazz.isAssignableFrom(o.getClass()))) {
            throw new ExecutionException("Object [" + org.springframework.util.ObjectUtils.identityToString(o) + "] is not an instance of "
                    + clazz.getSimpleName());
        }
        return (T)o;
    }
View Full Code Here

           
            if (declaredField != null) {
                return getFieldValue(object, declaredField, clazz);
            }
            else {
                throw new ExecutionException(object.getClass().getName() + " does not appear to contain field '" + fieldName + "'");
            }
        }
        catch (ExecutionException e) {
            throw e;
        }
        catch (Exception e) {
            throw new ExecutionException(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.exception.ExecutionException

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.