You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/10/08 09:25:35 UTC
svn commit: r1005717 -
/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
Author: davsclaus
Date: Fri Oct 8 07:25:34 2010
New Revision: 1005717
URL: http://svn.apache.org/viewvc?rev=1005717&view=rev
Log:
Fixed potential NPE in camel-restlet
Modified:
camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java?rev=1005717&r1=1005716&r2=1005717&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java (original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java Fri Oct 8 07:25:34 2010
@@ -242,17 +242,20 @@ public class DefaultRestletBinding imple
int responseCode = response.getStatus().getCode();
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, responseCode);
- // get content type
- MediaType mediaType = response.getEntity().getMediaType();
- if (mediaType != null) {
- exchange.getOut().setHeader(Exchange.CONTENT_TYPE, mediaType.toString());
- }
+ if (response.getEntity() != null) {
+ // get content type
+ MediaType mediaType = response.getEntity().getMediaType();
+ if (mediaType != null) {
+ exchange.getOut().setHeader(Exchange.CONTENT_TYPE, mediaType.toString());
+ }
- String text = response.getEntity().getText();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Populate exchange from Restlet response: " + text);
+ // get content text
+ String text = response.getEntity().getText();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Populate exchange from Restlet response: " + text);
+ }
+ exchange.getOut().setBody(text);
}
- exchange.getOut().setBody(text);
}
public HeaderFilterStrategy getHeaderFilterStrategy() {