rahulsmahadev commented on code in PR #18878:
URL: https://github.com/apache/iceberg/pull/18878#discussion_r4593510537
##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -169,6 +167,22 @@ public HTTPClient withAuthSession(AuthSession session) {
return new HTTPClient(this, session);
}
+ /**
+ * Returns the User-Agent recommended by the REST spec: the caller's product
tokens, if any,
+ * followed by the iceberg-java token and the JVM version as a comment.
+ */
+ @VisibleForTesting
+ static String userAgent(String callerTokens) {
+ String userAgent =
+ String.format(
+ "iceberg-java/%s (jvm %s)", IcebergBuild.version(),
System.getProperty("java.version"));
+ if (callerTokens == null || callerTokens.isBlank()) {
+ return userAgent;
+ }
+
+ return callerTokens.strip() + " " + userAgent;
Review Comment:
Good catch, thanks for testing it. Both properties now fail fast when the
client is built if the value has anything outside visible ASCII plus space
(0x20-0x7E).
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]