Skip to content
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

Java: Add tests for XML and Java extraction with GBK charset #18554

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Jan 21, 2025

The Java extraction unit test simply checks that a gbk-encoded comment extracts as expected. The XML integration test is a clone of an existing sibling test except with page.xml modified to use the same charset. Both would have failed until the CodeQL JDK (XML) and Java extractor JDK (Java source) were updated to include the jdk.charsets jmod.

@Copilot Copilot bot review requested due to automatic review settings January 21, 2025 17:44
@smowton smowton requested a review from a team as a code owner January 21, 2025 17:44
@github-actions github-actions bot added the Java label Jan 21, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 9 changed files in this pull request and generated no comments.

Files not reviewed (6)
  • java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/pom.xml: Language not supported
  • java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/source_archive.expected: Language not supported
  • java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/src/main/resources/my-app.properties: Language not supported
  • java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/src/main/resources/page.xml: Language not supported
  • java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/test.expected: Language not supported
  • java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/test.ql: Language not supported
Comments suppressed due to low confidence (3)

java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/src/test/java/com/example/AppTest.java:18

  • This test is not meaningful and does not cover any real behavior. It should test actual functionality.
assertTrue( true );

java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/src/main/java/com/example/App.java:20

  • [nitpick] The error message is unclear. Consider changing it to: "Wrong maven version, expected '" + expectedVersion + "' but got '" + observedVersion + "'. Maven home: " + mavenHome".
System.err.println("Wrong maven version, expected '" + expectedVersion + "' but got '" + observedVersion + "'" + mavenHome);

java/ql/integration-tests/java/maven-sample-xml-mode-all-gbk-encoding/src/main/java/com/example/App.java:26

  • [nitpick] The error message could be clearer. Consider changing it to: "Wrong command line, expected '" + commandMatcher + "' but got '" + command + "'."
System.err.println("Wrong command line, '" + command + "' does not match '" + commandMatcher + "'");

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

@smowton smowton force-pushed the smowton/admin/test-gbk-xml-extraction branch 2 times, most recently from abf4540 to c907d9a Compare February 19, 2025 22:27
@@ -0,0 +1 @@
semmle/code/java/PrintAst.ql

Check warning

Code scanning / CodeQL

Query test without inline test expectations Warning test

Query test does not use inline test expectations.
@smowton smowton force-pushed the smowton/admin/test-gbk-xml-extraction branch from c907d9a to 9162ce7 Compare February 20, 2025 12:31
@smowton smowton changed the title Java: Add test for XML extraction with GBK charset Java: Add tests for XML and Java extraction with GBK charset Feb 20, 2025
Copy link
Contributor

@jcogs33 jcogs33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving since it looks plausible to me, but one question below.

except with site.xml modified to use the same charset.

I'm not seeing a site.xml file, so I'm not sure if I'm missing some context. Is this meant to refer to page.xml?

@smowton
Copy link
Contributor Author

smowton commented Feb 21, 2025

Yes it is; fixed.

@smowton smowton merged commit 32e4c74 into github:main Feb 21, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants