camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From " Ramu kakarla (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-11216) REST-DSL - Producer fails with NPE or other exceptions if you have not set a hostname
Date Thu, 04 May 2017 15:29:04 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-11216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15996926#comment-15996926
] 

 Ramu kakarla edited comment on CAMEL-11216 at 5/4/17 3:28 PM:
---------------------------------------------------------------

Hi Claus,

I have reproduced the issue. By removing Host from restConfiguration 
restConfiguration().port(8080); gives Host value Null . This can be checked in populateRests
method of RouteBuilder class

##########################################################################################
        if (getRestConfigurations() != null) {
            for (Map.Entry<String, RestConfigurationDefinition> entry : getRestConfigurations().entrySet())
{
                RestConfiguration config = entry.getValue().asRestConfiguration(getContext());
                if ("".equals(entry.getKey())) {
                	if(entry.getValue().getHost()==null){
                	   throw new IllegalArgumentException("Host can't be null");
                               
                	}
###########################################################################
 Please verify this,so that I can raise pull req
Regards
Ramu


     








was (Author: kramu.k7):
Hi Claus,

I have reproduced the issue. By removing Host from restConfiguration 
restConfiguration().port(8080); gives Host value Null . This can be checked in populateRests
method of RouteBuilder class

##########################################################################################
        if (getRestConfigurations() != null) {
            for (Map.Entry<String, RestConfigurationDefinition> entry : getRestConfigurations().entrySet())
{
                RestConfiguration config = entry.getValue().asRestConfiguration(getContext());
                if ("".equals(entry.getKey())) {
                	if(entry.getValue().getHost()==null){
                	   throw new IllegalArgumentException("Host can't be null");
                               
                	}
        ---------      
  ##################################################################################################

 Please verify this,so that I can raise pull req
Regards
Ramu


     







> REST-DSL - Producer fails with NPE or other exceptions if you have not set a hostname
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-11216
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11216
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.19.0
>            Reporter: Claus Ibsen
>
> If you forget to configure a host name then the rest producer fails with different errors
if you use http4, netty4-http, undertow etc.
> We should likely add some validation logic in the rest endpoint / rest producer so it
can detect this missing configuration and report this in the same way.
> You can reproduce from this example by removing host at
> https://github.com/apache/camel/blob/master/examples/camel-example-rest-producer/src/main/java/sample/camel/RestRoute.java#L33



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message