-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[java] simplify strings processing #15309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use bos.toString(StandardCharsets.UTF_8) with String.format() for correctness, readability, and maintainability.
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
This pull request includes several changes to improve code readability and consistency in the Selenium project. The most important changes involve replacing deprecated string methods and updating header content type handling.
Improvements to code readability and consistency:
java/src/dev/selenium/tools/modules/ModuleGenerator.java
: Simplified the error message concatenation by removing unnecessarynew String
conversion.java/src/org/openqa/selenium/Cookie.java
: Replaced("".equals(path))
withpath.isEmpty()
for better readability.java/src/org/openqa/selenium/Platform.java
: Replaced("".equals(matcher))
withmatcher.isEmpty()
for better readability.java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java
: Removed unnecessarytoString()
call onJSON_UTF_8
when setting the content type header.Motivation and Context
Types of changes
Checklist
PR Type
Enhancement
Description
Simplified string operations for better readability.
Replaced deprecated or redundant string methods.
Improved header content type handling in HTTP requests.
Enhanced error message concatenation in module processing.
Changes walkthrough 📝
ModuleGenerator.java
Simplified error message concatenation logic
java/src/dev/selenium/tools/modules/ModuleGenerator.java
new String
conversion.Cookie.java
Improved readability in cookie string representation
java/src/org/openqa/selenium/Cookie.java
("".equals(path))
withpath.isEmpty()
.Platform.java
Improved OS name matching readability
java/src/org/openqa/selenium/Platform.java
("".equals(matcher))
withmatcher.isEmpty()
.AbstractHttpCommandCodec.java
Simplified header content type handling
java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java
toString()
call onJSON_UTF_8
.