[Java] refactor: replace deprecated ErrorCodes.SUCCESS_STRING #15946
+3
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
with literal "success"
Replaced usage of ErrorCodes.SUCCESS_STRING with the literal string "success" in ProtocolHandshake.java and RemotableByTest.java, as ErrorCodes is marked @deprecated(forRemoval = true).
Also removed direct use of ErrorCodes.SUCCESS and related methods like errorCodes.toStatusCode(e) in preparation for full W3C compliance, where status and state fields are no longer needed or recommended in responses.
This change aligns the codebase with the W3C WebDriver protocol by reducing reliance on deprecated JSON Wire Protocol conventions.
💥 What does this PR do?
This PR removes the use of deprecated constants and methods from the ErrorCodes class by:
• Replacing ErrorCodes.SUCCESS_STRING with the literal "success" in ProtocolHandshake.java and RemotableByTest.java.
• Removing calls to setStatus() and setState() in response objects, which are no longer required under the W3C WebDriver protocol.
• Eliminating the use of errorCodes.toStatusCode(e) and errorCodes.toState(...) when building error responses, since the W3C protocol does not rely on numeric status codes or legacy state strings.
These changes simplify the codebase and move it closer to full W3C compliance by avoiding outdated JSON Wire Protocol constructs.
🔄 Types of changes
PR Type
Other
Description
Replace deprecated
ErrorCodes.SUCCESS_STRING
with literal "success"Remove deprecated
setStatus()
calls from response objectsEliminate unused
ErrorCodes
imports and instancesAlign codebase with W3C WebDriver protocol standards
Changes walkthrough 📝
ProtocolHandshake.java
Remove deprecated ErrorCodes usage in response creation
java/src/org/openqa/selenium/remote/ProtocolHandshake.java
response.setStatus(ErrorCodes.SUCCESS)
callErrorCodes.SUCCESS_STRING
with literal "success"RemotableByTest.java
Clean up deprecated ErrorCodes usage in tests
java/test/org/openqa/selenium/remote/RemotableByTest.java
ErrorCodes.SUCCESS_STRING
ErrorCodes
instance variableSUCCESS_STRING
with literal "success"