Skip to content

Conversation

@iampopovich
Copy link
Contributor

🔗 Related Issues

💥 What does this PR do?

This change fixes a code inspector warning: https://checkstyle.sourceforge.io/checks/misc/avoidescapedunicodecharacters.html

In my opinion, it improves the readability of scripts, for example, in this code block: https://github.com/SeleniumHQ/selenium/blob/6c607a840299ef78ad342e3fc1aff3933beec0d1/java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec.java#L328C1-L340C1


      case SUBMIT_ELEMENT:
        return toScript(
            "/* submitForm */var form = arguments[0];\n"
                + "while (form.nodeName != \"FORM\" && form.parentNode) {\n"
                + "  form = form.parentNode;\n"
                + "}\n"
                + "if (!form) { throw Error('Unable to find containing form element'); }\n"
                + "if (!form.ownerDocument) { throw Error('Unable to find owning document'); }\n"
                + "var e = form.ownerDocument.createEvent('Event');\n"
                + "e.initEvent('submit', true, true);\n"
                + "if (form.dispatchEvent(e)) { HTMLFormElement.prototype.submit.call(form) }\n",
            asElement(parameters.get("id")));

The changes are minor but they affect JS scripts in multiline strings. We need to make sure that the scripts are not broken.

🔧 Implementation Notes

I replaced string concatenation with text blocks, since the project's minimum requirement of JDK 17 supports this feature.

💡 Additional Considerations

🔄 Types of changes

  • Cleanup (formatting, renaming)

@selenium-ci selenium-ci added B-grid Everything grid and server related C-java Java Bindings B-devtools Includes everything BiDi or Chrome DevTools related labels Jul 8, 2025
@iampopovich
Copy link
Contributor Author

build was not successful
sorry

        ^
 (use -source 15 or higher to enable text blocks)
java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec.java:217: error: text blocks are not supported in -source 11
           """
           ^
 (use -source 15 or higher to enable text blocks)
INFO: Elapsed time: 174.125s, Critical Path: 19.89s
INFO: 1645 processes: 990 internal, 532 darwin-sandbox, 67 local, 56 worker.
ERROR: Build did NOT complete successfully
//java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest-remote NO STATUS
//java/test/org/openqa/selenium/federatedcredentialmanagement:FederatedCredentialManagementTest NO STATUS
//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest NO STATUS
//java/test/org/openqa/selenium/remote:RemoteWebDriverBuilderTest     NO STATUS
//java/test/org/openqa/selenium/firefox:FirefoxDriverBuilderTest FAILED TO BUILD

@iampopovich iampopovich closed this Jul 8, 2025
@iampopovich
Copy link
Contributor Author

i did not notice there is still java 11 as default target

build --javacopt="--release 11"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-devtools Includes everything BiDi or Chrome DevTools related B-grid Everything grid and server related C-java Java Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants