NXCALS-2498: Dedicated exceptions on service.url system property validation
#Merge request template @acc-logging-team - please have a look for approval.
- Running app without specifying the
service.url
property
Exception in thread "main" java.lang.ExceptionInInitializerError
at cern.nxcals.api.extraction.metadata.ServiceClientFactory.<clinit>(ServiceClientFactory.java:15)
at cern.nxcals.api.backport.client.service.ServiceBuilder.createMetaService(ServiceBuilder.java:40)
at cern.nxcals.api.extraction.data.demo.Application.main(Application.java:57)
Caused by: java.lang.IllegalStateException: Cannot find list of NXCALS service urls! No property [service.url] was specified.
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.createServiceURL(AbstractClientFactory.java:76)
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.<init>(AbstractClientFactory.java:47)
at cern.nxcals.api.extraction.metadata.InternalClientFactory.<init>(InternalClientFactory.java:35)
at cern.nxcals.api.extraction.metadata.InternalClientFactory.<clinit>(InternalClientFactory.java:22)
- Running app with
System.setProperty("service.url", "asdfe");
Exception in thread "main" java.lang.ExceptionInInitializerError
at cern.nxcals.api.extraction.metadata.ServiceClientFactory.<clinit>(ServiceClientFactory.java:15)
at cern.nxcals.api.backport.client.service.ServiceBuilder.createMetaService(ServiceBuilder.java:40)
at cern.nxcals.api.extraction.data.demo.Application.main(Application.java:57)
Caused by: java.lang.IllegalStateException: Invalid content [asdfe] for property [service.url]! Invalid URL value [asdfe]. Please, provide valid set of comma separated service URLs
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.validateServiceURL(AbstractClientFactory.java:87)
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.createServiceURL(AbstractClientFactory.java:79)
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.<init>(AbstractClientFactory.java:47)
at cern.nxcals.api.extraction.metadata.InternalClientFactory.<init>(InternalClientFactory.java:35)
at cern.nxcals.api.extraction.metadata.InternalClientFactory.<clinit>(InternalClientFactory.java:22)
- Running app with
System.setProperty("service.url","http://cs-ccr-nxcals6.cern.ch:19093,sdf:random/stuff");
(1 valid, 1 invalid url)
Exception in thread "main" java.lang.ExceptionInInitializerError
at cern.nxcals.api.extraction.metadata.ServiceClientFactory.<clinit>(ServiceClientFactory.java:15)
at cern.nxcals.api.backport.client.service.ServiceBuilder.createMetaService(ServiceBuilder.java:40)
at cern.nxcals.api.extraction.data.demo.Application.main(Application.java:56)
Caused by: java.lang.IllegalStateException: Invalid content [http://cs-ccr-nxcals6.cern.ch:19093,sdf:random/stuff] for property [service.url]! Invalid URL value [sdf:random/stuff]. Please, provide valid set of comma separated service URLs
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.validateServiceURL(AbstractClientFactory.java:84)
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.createServiceURL(AbstractClientFactory.java:76)
at cern.nxcals.api.extraction.metadata.AbstractClientFactory.<init>(AbstractClientFactory.java:44)
at cern.nxcals.api.extraction.metadata.InternalClientFactory.<init>(InternalClientFactory.java:35)
at cern.nxcals.api.extraction.metadata.InternalClientFactory.<clinit>(InternalClientFactory.java:22)
- Running app with:
System.setProperty("service.url", "http://cs-ccr-nxcals6.cern.ch:19093,https://cs-ccr-nxcals7.cern.ch:19093,http://cs-ccr-nxcals8.cern.ch:19093");
And got the following warning:
2020-03-05 12:24:14.591 [INFO ] [main] Application - Started Application in 3.928 seconds (JVM running for 5.298)
2020-03-05 12:24:14.721 [WARN ] [main] AbstractClientFactory - Provided service url [http://cs-ccr-nxcals6.cern.ch:19093] is under http scheme (might be problematic)! Should use https instead.
2020-03-05 12:24:14.721 [WARN ] [main] AbstractClientFactory - Provided service url [http://cs-ccr-nxcals8.cern.ch:19093] is under http scheme (might be problematic)! Should use https instead.
Closes NXCALS-2498
Edited by Grigorios Avgitidis