Hi , why my try block is skipping and control is going to finally block with out giving any exception?

my code is like below

try{
    System.out.println("index"+index);
    System.out.println("Inside getPayloadFromKibana elsatic host" + elasticHost);
    RestHighLevelClient restClient = new RestHighLevelClient(RestClient
                    .builder(new HttpHost(elasticHost, 7008, "http"))//here port number is differnt.
                    .setRequestConfigCallback(
                            requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(60000).setSocketTimeout(60000))
                    .setMaxRetryTimeoutMillis(60000));
    System.out.println("restClient ::"+restClient);
    SearchRequest searchRequest = new SearchRequest();
    -----
    }catch(Exception e){
    }
    finally{}

when i execute my project in debug mode i see that my controll is going to finally block when ever it runs on RestHighLevelClient creating object , and it is not giving any exception or not coming into catch block , why it is behaving like this can any one please help here?



Read more here: https://stackoverflow.com/questions/68467554/hi-why-my-try-block-is-skipping-and-control-is-going-to-finally-block-with-out

Content Attribution

This content was originally published by Ganesh Bejawada at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: