Package org.apache.camel

Examples of org.apache.camel.CamelException


            if (genericType instanceof ParameterizedType) {
                // Get the collection member type first
                Type[] actualTypeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
                response = client.invokeAndGetCollection(httpMethod, body, (Class)actualTypeArguments[0]);
            } else {
                throw new CamelException("Can't find the Collection member type");
            }
        } else {
            response = client.invoke(httpMethod, body, responseClass);
        }
       
View Full Code Here


    public void testToSourceUsingTypeConverter() {
        // this time the fall back converter will be use
        exchange.getIn().setBody(order);
        Source source = exchange.getIn().getBody(Source.class);
        assertTrue("The result source should be Source instance", source instanceof Source);
        exchange.getIn().setBody(new CamelException("Test"));
        source = exchange.getIn().getBody(Source.class);
        assertNull("The result should be null", source);
    }
View Full Code Here

    public void testToDocumentUsingTypeConverter() {
        // this time the fall back converter will be use
        exchange.getIn().setBody(order);
        Document document = exchange.getIn().getBody(Document.class);
        assertNotNull("The result source should not be JAXBSource", document != null);
        exchange.getIn().setBody(new CamelException("Test"));
        document = exchange.getIn().getBody(Document.class);
        assertNull("The result should be null", document);
    }
View Full Code Here

    /**
     * Unsupported operation. We cannot create ugly HTML.
     */
    public void marshal(Exchange exchange, Object object, OutputStream outputStream) throws Exception {
        throw new CamelException("Marshalling from Well Formed HTML to ugly HTML is not supported."
                + " Only unmarshal is supported");
    }
View Full Code Here

        try {
            parser.parse(new InputSource(inputStream));
            return w.toString();

        } catch (Exception e) {
            throw new CamelException("Failed to convert the HTML to tidy Markup", e);
        } finally {
            try {
                inputStream.close();
            } catch (Exception e) {
                LOG.warn("Failed to close the inputStream");
View Full Code Here

            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            DOMResult result = new DOMResult();
            transformer.transform(new SAXSource(parser, new InputSource(inputStream)), result);
            return result.getNode();
        } catch (Exception e) {
            throw new CamelException("Failed to convert the HTML to tidy Markup", e);
        }
    }
View Full Code Here

        if (Message.class.isAssignableFrom(instanceClass)) {
            try {
                Method method = instanceClass.getMethod("getDefaultInstance", new Class[0]);
                return (Message) method.invoke(null, new Object[0]);
            } catch (Exception ex) {
                throw new CamelException("Can't set the defaultInstance of ProtobufferDataFormat with "
                                         + className + ", caused by " + ex);
            }
        } else {
            throw new CamelException("Can't set the defaultInstance of ProtobufferDataFormat with "
                  + className + ", as the class is not a subClass of com.google.protobuf.Message");
        }
    }
View Full Code Here

     */
    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
              
        if (defaultInstance == null) {
            if (instanceClassName == null) {
                throw new CamelException("There is not defaultInstance for protobuf unmarshaling");
            } else {
                synchronized (this) {
                    if (defaultInstance == null) {
                        defaultInstance = loadDefaultInstance(instanceClassName, exchange.getContext());
                    }
View Full Code Here

        try {
            context.addRoutes(new RouteBuilder() {
   
                @Override
                public void configure() throws Exception {
                    from("direct:unmarshalC").unmarshal().protobuf(new CamelException("wrong instance"))
                        .to("mock:reverse");
   
                }
            });
            fail("Expect the exception here");
View Full Code Here

                    RoutesBuilder routes = builderRef.createRoutes(getContext());
                    if (routes != null) {
                        this.builders.add(routes);
                    } else {
                        // Throw the exception that we can't find any build here
                        throw new CamelException("Cannot find any routes with this RouteBuilder reference: " + builderRef);
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.camel.CamelException

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.