Skip to content

[java] restore ClientConfig constructor used by Appium (for backward compatibility)#16874

Merged
asolntsev merged 1 commit intoSeleniumHQ:trunkfrom
asolntsev:restore-client-config-constructor
Jan 9, 2026
Merged

[java] restore ClientConfig constructor used by Appium (for backward compatibility)#16874
asolntsev merged 1 commit intoSeleniumHQ:trunkfrom
asolntsev:restore-client-config-constructor

Conversation

@asolntsev
Copy link
Copy Markdown
Contributor

@asolntsev asolntsev commented Jan 9, 2026

User description

This constructor disappeared in PR #16796 when wsTimeout parameter was added.

But Appium still uses it.
People would not be able to update Selenium version, while staying on a previous Appium version.

💥 What does this PR do?

Restores ClientConfig constructor (without wsTimeout parameter) that existed in Selenium 4.39.0.

🔄 Types of changes

  • Bug fix (backwards compatible)

PR Type

Bug fix


Description

  • Restores removed ClientConfig constructor for backward compatibility

  • Constructor without wsTimeout parameter used by Appium

  • Delegates to full constructor with default wsTimeout value

  • Extracts timeout defaults into private helper methods


Diagram Walkthrough

flowchart LR
  A["ClientConfig constructor<br/>without wsTimeout"] -->|delegates to| B["ClientConfig constructor<br/>with wsTimeout"]
  B -->|uses| C["defaultWsTimeout()"]
  B -->|uses| D["defaultReadTimeout()"]
  B -->|uses| E["defaultConnectionTimeout()"]
Loading

File Walkthrough

Relevant files
Bug fix
ClientConfig.java
Restore constructor and extract timeout defaults                 

java/src/org/openqa/selenium/remote/http/ClientConfig.java

  • Adds new protected constructor without wsTimeout parameter that
    delegates to existing constructor
  • Extracts timeout default values into three private static helper
    methods (defaultWsTimeout(), defaultReadTimeout(),
    defaultConnectionTimeout())
  • Refactors defaultConfig() method to use the new helper methods for
    cleaner code
  • Maintains backward compatibility with Appium and other clients using
    the old constructor signature
+39/-6   

… backward compatibility)

This constructor disappeared in PR SeleniumHQ#16796 when `wsTimeout` parameter was added.
@asolntsev asolntsev self-assigned this Jan 9, 2026
@asolntsev asolntsev added this to the 4.40.0 milestone Jan 9, 2026
@selenium-ci selenium-ci added the C-java Java Bindings label Jan 9, 2026
@qodo-code-review
Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Unhandled parse failures: The new default timeout helpers call Long.parseLong(System.getProperty(...)) without
guarding against non-numeric values, which can throw at runtime instead of failing
gracefully.

Referred Code
private static Duration defaultWsTimeout() {
  return Duration.ofSeconds(
      Long.parseLong(System.getProperty("webdriver.httpclient.wsTimeout", "30")));
}

private static Duration defaultReadTimeout() {
  return Duration.ofSeconds(
      Long.parseLong(System.getProperty("webdriver.httpclient.readTimeout", "180")));
}

private static Duration defaultConnectionTimeout() {
  return Duration.ofSeconds(
      Long.parseLong(System.getProperty("webdriver.httpclient.connectionTimeout", "10")));
}

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Unvalidated external input: System properties used for timeouts are treated as trusted numeric input without
validation/sanitization, which may allow invalid values to cause unexpected failures or
unsafe timeout settings.

Referred Code
private static Duration defaultWsTimeout() {
  return Duration.ofSeconds(
      Long.parseLong(System.getProperty("webdriver.httpclient.wsTimeout", "30")));
}

private static Duration defaultReadTimeout() {
  return Duration.ofSeconds(
      Long.parseLong(System.getProperty("webdriver.httpclient.readTimeout", "180")));
}

private static Duration defaultConnectionTimeout() {
  return Duration.ofSeconds(
      Long.parseLong(System.getProperty("webdriver.httpclient.connectionTimeout", "10")));
}

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@asolntsev asolntsev changed the title #16270 restore ClientConfig constructor used by Appium (for backward compatibility) [java] restore ClientConfig constructor used by Appium (for backward compatibility) Jan 9, 2026
@qodo-code-review
Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Use Long.getLong for parsing system properties

Use Long.getLong() instead of Long.parseLong(System.getProperty(...)) to
robustly parse the timeout system property and handle non-numeric values
gracefully.

java/src/org/openqa/selenium/remote/http/ClientConfig.java [100-103]

 private static Duration defaultWsTimeout() {
   return Duration.ofSeconds(
-      Long.parseLong(System.getProperty("webdriver.httpclient.wsTimeout", "30")));
+      Long.getLong("webdriver.httpclient.wsTimeout", 30));
 }
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: This suggestion correctly identifies that Long.getLong is a more robust and idiomatic way to parse long values from system properties, as it internally handles potential NumberFormatException and returns a default value, thus improving code quality and resilience.

Medium
  • More

@asolntsev asolntsev merged commit 49b2e8d into SeleniumHQ:trunk Jan 9, 2026
14 of 15 checks passed
@asolntsev asolntsev deleted the restore-client-config-constructor branch January 9, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants