Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public static void withProduct(String product, String productVersion) {
private static final Pattern regexpSemVer =
Pattern.compile("^" + semVerCore + semVerPrerelease + semVerBuildmetadata + "$");

private static final Pattern regexpAlphanum = Pattern.compile("^[0-9A-Za-z_\\.\\+-]+$");
private static final Pattern regexpAlphanumInverse = Pattern.compile("[^0-9A-Za-z_\\.\\+-]");
private static final Pattern regexpAlphanum = Pattern.compile("^[0-9A-Za-z_\\.\\+\\-/ ]+$");
private static final Pattern regexpAlphanumInverse = Pattern.compile("[^0-9A-Za-z_\\.\\+\\-/ ]");

/**
* Replaces all non-alphanumeric characters with a hyphen. Use this to ensure that the user agent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@ public void testUserAgentWithSemverValue() {
String userAgent = UserAgent.asString();
Assertions.assertTrue(userAgent.contains("key1/1.0.0-dev+metadata"));
}

@Test
public void testUserAgentWithSQLDriverUserAgent() {
UserAgent.withOtherInfo("Java", "SQLExecHttpClient/HC TEST/42.2.0.2712019");
String userAgent = UserAgent.asString();
Assertions.assertTrue(userAgent.contains("Java/SQLExecHttpClient/HC TEST/42.2.0.2712019"));
}
}
Loading