Skip to content

Conversation

@yutaro-sakamoto
Copy link
Contributor

This pull request introduces a version compatibility check for indexed files in the COBOL runtime, ensuring that older file formats are detected and handled gracefully. It adds a new status code for version incompatibility, implements logic to detect outdated indexed file schemas, and expands the test suite to cover this scenario.

File version compatibility and error handling:

  • Added a new status code COB_STATUS_92_VERSION_INCOMPATIBLE to CobolFile and updated methods (open, cob_delete_file) to handle this status, allowing the runtime to report version incompatibility errors. [1] [2] [3]
  • Implemented the checkVersionOld() method in CobolIndexedFile to verify that required tables and columns exist in the indexed file's SQLite database, returning the new status code if the file format is outdated. This check is now invoked before opening an existing file. [1] [2]

Testing and build system:

  • Added a new test case old-file.at which was created with opensource COBOL 4J 1.1.11 to verify that the system correctly detects and reports version incompatibility for old indexed files.
  • Updated test suite build files (Makefile.am, Makefile.in, and indexed-lock.at) to include the new test. [1] [2] [3]

@yutaro-sakamoto yutaro-sakamoto marked this pull request as ready for review August 22, 2025 08:27
Copilot AI review requested due to automatic review settings August 22, 2025 08:27
Copy link
Contributor

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.

Pull Request Overview

This pull request implements version compatibility checking for COBOL indexed files to handle legacy file formats gracefully. When opening an older indexed file that lacks required database schema elements, the system now returns a specific error status (92) instead of failing unexpectedly.

  • Added new status code COB_STATUS_92_VERSION_INCOMPATIBLE for version mismatch scenarios
  • Implemented checkVersionOld() method to validate SQLite database schema requirements
  • Added comprehensive test coverage for the version compatibility feature

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
CobolFile.java Added new status code 92 and updated open/delete methods to handle version incompatibility
CobolIndexedFile.java Implemented version checking logic that validates required tables and columns in SQLite database
old-file.at Added new test case to verify proper handling of outdated indexed file formats
indexed-lock.at Updated test suite to include the new version compatibility test
Makefile.am/in Updated build configuration to include the new test file

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@yutaro-sakamoto
Copy link
Contributor Author

Tests fail in rare cases.
https://github.com/opensourcecobol/opensourcecobol4j/actions/runs/17150361079/attempts/1?pr=694
The cause is that JVM prints warning message of performance.
https://stackoverflow.com/questions/79559390/warning-log-cannot-use-file-tmp-hsperfdata-user-xxxxx-because-it-is-locked-b

After merging this pull request, I will fix the problem.

@yutaro-sakamoto yutaro-sakamoto merged commit dbcfae7 into opensourcecobol:develop Aug 26, 2025
286 of 290 checks passed
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