В Restclient.exchange Call напрямую переходит в блок finally - PullRequest
0 голосов
/ 26 сентября 2019
Here is the sudo code for this Issue/// Control is moving to finally after the rest call… Not even printing the  exception    or any other log.

Я пытаюсь выполнить запрос Http.GET с помощью restClient.

public class SudoCode {
        public static void main(String[] args) {
            SudoCode c= new SudoCode();
            try{
                System.out.println("before Rest Call");
                c.RestCall(1, "Test");
            }
            catch (Exception e) {
                System.out.println("After Rest Call");
                System.out.println(e.getMessage());
                // TODO: handle exception
            }
            finally {
                System.out.println("In Finally");
            }
        }
        public void RestCall(int a, String b)
        {
            try
            {
                System.out.println("In Rest Call before");
                ResponseEntity response=RestTemplet.exchange(.a...a.);
                System.out.println("In Rest Call After");
            }
            catch(Exception e)
            {
                System.out.println("In Rest Call Exception");
                System.out.println(e.getMessage());
            }
        }
    }
    //Output ::
    before Rest Call
    In Rest Call before
    In Finally

Вот код sudo для этой проблемы /// Элемент управления переходит к окончательно после вызова остальных ...Даже не печатая исключения или любые другие журналы

...