Skip to content

fix(AIENG-359): Improve text detection by using ByteBuffer and charse…#1318

Open
psakthivel04 wants to merge 4 commits into
mainfrom
fix/AIENG-359-text
Open

fix(AIENG-359): Improve text detection by using ByteBuffer and charse…#1318
psakthivel04 wants to merge 4 commits into
mainfrom
fix/AIENG-359-text

Conversation

@psakthivel04

@psakthivel04 psakthivel04 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

This pull request updates the logic for detecting whether a file is text or binary in the GitFile class and adds comprehensive tests to ensure correctness. The main change replaces the previous character-based reading approach with a more robust UTF-8 decoder, and new unit tests are introduced to cover various scenarios.

Improvements to text/binary file detection:

  • The isText() method in GitFile now uses a UTF-8 decoder with strict error reporting to determine if file content is valid UTF-8, making detection of binary files more accurate and efficient.

Testing enhancements:

  • Added a new test class GitFileTest with unit tests for isText(), covering text files, binary files, and multi-byte UTF-8 content.
  • Registered GitFileTest in the AllTests suite to ensure it is run with other tests.

Code cleanup:

  • Removed unused imports and added necessary ones in GitFile.java to support the new decoding logic.

@Konboi

Konboi commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This change sounds nice however we need to fix this change not only the smart-tests-cli command (v2) but also the launchable command (v1), right?
So, could you create a PR from v1 branch and merge into v1, fist? Next, please merge v1 branch into the main.

Also when you update the Java code, please run build-java.sh to update exe_deploy.jar file

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants