Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11398

camel-google-calendar should throw more friendly exception when the required credentials lack

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.19.0
    • 2.19.2, 2.20.0
    • None
    • None
    • Unknown

    Description

      The GoogleCalendar component simply throws NPE when there is no credential set on the configuration like this:

      2017-06-12 23:05:06.518 ERROR 17546 --- [           main] c.c.g.c.BatchGoogleCalendarClientFactory : Could not create Google Drive client.
      
      java.lang.NullPointerException: null
      	at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213) ~[google-http-client-1.22.0.jar:1.22.0]
      	at com.google.api.client.util.Preconditions.checkNotNull(Preconditions.java:127) ~[google-http-client-1.22.0.jar:1.22.0]
      	at com.google.api.client.auth.oauth2.ClientParametersAuthentication.<init>(ClientParametersAuthentication.java:89) ~[google-oauth-client-1.22.0.jar:1.22.0]
      	at com.google.api.client.googleapis.auth.oauth2.GoogleCredential$Builder.setClientSecrets(GoogleCredential.java:546) ~[google-api-client-1.22.0.jar:1.22.0]
      	at org.apache.camel.component.google.calendar.BatchGoogleCalendarClientFactory.authorize(BatchGoogleCalendarClientFactory.java:75) ~[camel-google-calendar-2.18.1.redhat-000005.jar:2.18.1.redhat-000005]
      	at org.apache.camel.component.google.calendar.BatchGoogleCalendarClientFactory.makeClient(BatchGoogleCalendarClientFactory.java:54) ~[camel-google-calendar-2.18.1.redhat-000005.jar:2.18.1.redhat-000005]
      	at org.apache.camel.component.google.calendar.GoogleCalendarComponent.getClient(GoogleCalendarComponent.java:49) [camel-google-calendar-2.18.1.redhat-000005.jar:2.18.1.redhat-000005]
      	at org.apache.camel.component.google.calendar.GoogleCalendarEndpoint.getClient(GoogleCalendarEndpoint.java:114) [camel-google-calendar-2.18.1.redhat-000005.jar:2.18.1.redhat-000005]
      	at org.apache.camel.component.google.calendar.GoogleCalendarEndpoint.afterConfigureProperties(GoogleCalendarEndpoint.java:100) [camel-google-calendar-2.18.1.redhat-000005.jar:2.18.1.redhat-000005]
      [...]
      
      2017-06-12 23:05:06.561 ERROR 17546 --- [           main] o.s.boot.SpringApplication               : Application startup failed
      
      org.apache.camel.spring.boot.CamelSpringBootInitializationException: org.apache.camel.FailedToCreateRouteException: Failed to create route entries-list at: >>> To[google-calendar://events/list?inBody=calendarId] <<< in route: Route(entries-list)[[From[rest:get:/calendar:/?routeId=entri... because of Failed to resolve endpoint: google-calendar://events/list?inBody=calendarId due to: null
      [...]
      Caused by: java.lang.NullPointerException: null
      	at org.apache.camel.component.google.calendar.GoogleCalendarEndpoint.afterConfigureProperties(GoogleCalendarEndpoint.java:100) ~[camel-google-calendar-2.18.1.redhat-000005.jar:2.18.1.redhat-000005]
      

      It should throw a more explanatory and use-friendly exception.

      Attachments

        Issue Links

          Activity

            People

              tadayosi Tadayoshi Sato
              tadayosi Tadayoshi Sato
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: