gnodet opened a new pull request, #31281:
URL: https://github.com/apache/camel/pull/31281
## Summary
Fix `BatchGoogleDriveClientFactory` to throw `IllegalArgumentException` when
the proxy
host cannot be resolved, instead of swallowing the `UnknownHostException`
and leaving
`transport` and `jsonFactory` as `null`.
## Root Cause
The `BatchGoogleDriveClientFactory(String proxyHost, int proxyPort)`
constructor caught
`UnknownHostException`, logged it (`"Unknow proxy host"` — also a typo), and
returned
normally. This left `transport` and `jsonFactory` uninitialized (`null`).
Any subsequent
call to `makeClient(...)` would reach `new Drive.Builder(transport,
jsonFactory, credential)`,
which calls `Preconditions.checkNotNull(transport)` and throws a
`NullPointerException`
with no hint about the actual cause.
## Fix
Replace the `catch (UnknownHostException e)` log-and-swallow with:
```java
throw new IllegalArgumentException("Unknown proxy host: " + proxyHost, e);
```
This fails fast at construction time with a clear message, fixes the typo,
and removes the
dead `LOG` field (the logger import is no longer needed either).
## Tests
`BatchGoogleDriveClientFactoryTest.unknownProxyHostThrowsIllegalArgumentException`
verifies
that constructing the factory with an unresolvable hostname throws
`IllegalArgumentException`
immediately, before any client can be created.
Fixes CAMEL-27973
---
_Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]