Tadayoshi Sato created CAMEL-11398:
--------------------------------------
Summary: camel-google-calendar should throw more friendly
exception when the required credentials lack
Key: CAMEL-11398
URL: https://issues.apache.org/jira/browse/CAMEL-11398
Project: Camel
Issue Type: Improvement
Affects Versions: 2.19.0
Reporter: Tadayoshi Sato
Assignee: Tadayoshi Sato
The GoogleCalendar component simply throws NPE when there is no credential set
on the configuration like this:
{code}
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]
{code}
It should throw a more explanatory and use-friendly exception.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)