Restlet component fails with NPE if used in combination with dynamic recipients
(recipientList())
-------------------------------------------------------------------------------------------------
Key: CAMEL-1628
URL: https://issues.apache.org/activemq/browse/CAMEL-1628
Project: Apache Camel
Issue Type: Bug
Affects Versions: 2.0-M1
Environment: WinXP SP3, Java 5 (suspect not relevant to this problem)
Restlet 1.1.1 (suspect not relevant to this problem)
Reporter: Dan Haywood
see also:
http://www.nabble.com/How-extract-message-body-and-use-later-on-in-route-for-endpoint--td23612034.html
I've got:
private static final String HOST_URI = "http://localhost:7070";
from("direct:getEmployee")
.to("restlet:" + HOST_URI + "/services")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
String resourcePath = ... xpath to obtain the resource path from
exchange.getIn().getBody()
message.setBody(resourcePath);
exchange.setOut(message);
}
}).recipientList(new ExpressionAdapter(){
public Object evaluate(Exchange exchange) {
return "restlet:" + HOST_URI + exchange.getIn().getBody();
}
});
The first restlet call succeeds, returning an XHTML entity. The processor then
extracts a resource from an <a href>
The ExpressionAdapter dynamically constructs a new Uri to invoke via Restlet.
However, this second restlet call fails, with a nullpointerexception. It seems
that the org.restlet.Restlet is instantiated with the default constructor. For
the first successful call the Restlet#init() method is called, so its context
is setup correctly. But for the second restlet call #init() doesn't seem to
get called.
This ultimately triggers the NPE in
com.neolios.restlet.http.HttpConverter#addAdditionalHeaders, trying to get a
Logger from this context object, but it is passed in from RestletComponent
which I imagine wraps the Restlet.
My guess is that it is the dynamic creation of the recipientList is what's
ultimately responsible for this failure to call #init()?
This is Camel 2.0-M1 against Restlet 1.1.1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.