diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 80027df6..4f67db52 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -17,18 +17,23 @@ jobs: container: image: ${{ matrix.os }} steps: - + + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + - name: Install dependencies on Ubuntu 22.04 if: matrix.os == 'ubuntu:22.04' run: | apt update -y - apt install -y default-jdk build-essential bison flex gettext texinfo automake autoconf + apt install -y build-essential bison flex gettext texinfo automake autoconf - name: Install dependencies on AlmaLinux 9 if: matrix.os == 'almalinux:9' run: | dnf -y update - dnf install -y java-17-openjdk-devel gcc make bison flex automake autoconf diffutils gettext + dnf install -y gcc make bison flex automake autoconf diffutils gettext - name: Checkout opensource COBOL 4J uses: actions/checkout@v3 @@ -90,7 +95,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '17' + java-version: '11' - name: Install static analysis tools run: | diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 0d190792..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Make a coverate report - -on: - workflow_dispatch: - -env: - CLASSPATH: ":/usr/lib/opensourcecobol4j/libcobj.jar" - -jobs: - run-tests: - runs-on: ubuntu-latest - steps: - - - name: Install dependencies on Ubuntu 22.04 - run: | - sudo apt update -y - sudo apt install -y default-jdk build-essential bison flex gettext texinfo automake autoconf gcovr - - - name: Checkout opensource COBOL 4J - uses: actions/checkout@v3 - - - name: Install opensource COBOL 4J - run: | - ./configure CFLAGS='-fprofile-arcs -ftest-coverage' --prefix=/usr/ - make - sudo make install - - #- name: Run tests "command-line-options" - # run: | - # cd tests/ - # ./command-line-options - - #- name: Run tests "misc" - # run: | - # cd tests/ - # ./misc - - #- name: Run tests "data-rep" - # run: | - # cd tests/ - # ./data-rep - - #- name: Run tests "i18n_sjis" - # run: | - # cd tests/ - # ./i18n_sjis - - #- name: Run tests "jp-compat" - # run: | - # cd tests/ - # ./jp-compat - - #- name: Run tests "run" - # run: | - # cd tests/ - # ./run - - #- name: Run tests "syntax" - # run: | - # cd tests/ - # ./syntax - - #- name: Run NIST test - # run: | - # cd tests/cobol85 - # make test - - #- name: Run Extra NIST test - # run: | - # cd tests/cobol85 - # make test-extra - - # #- name: Run tests "i18n_utf8" - # # run: | - # # ./configure --prefix=/usr/ --with-vbisam --enable-utf8 - # # make - # # make install - # # ./i18n_utf8 || true - # # cd ../ - - #- name: Make a coverage report - # run: | - # cd cobj - # gcov -l *.gcda - # gcovr -r . --html -o report.html - # mkdir coverage-report - # cp *.gcno *.gcda *.gcov report.html coverage-report - - #- name: Archive a coverage report - # uses: actions/upload-artifact@v3 - # with: - # name: code-coverage-report - # path: cobj/coverage-report/ \ No newline at end of file diff --git a/.github/workflows/test-nist.yml b/.github/workflows/test-nist.yml index 511950df..e40e96fd 100644 --- a/.github/workflows/test-nist.yml +++ b/.github/workflows/test-nist.yml @@ -29,17 +29,22 @@ jobs: with: name: opensourcecobol4j-${{ env.ARTIFACT_NAME }} + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + - name: Install dependencies on Ubuntu 22.04 if: matrix.os == 'ubuntu:22.04' run: | apt update -y - apt install -y default-jdk build-essential + apt install -y build-essential - name: Install dependencies on AlmaLinux 9 if: matrix.os == 'almalinux:9' run: | dnf -y update - dnf install -y java-17-openjdk-devel gcc make perl + dnf install -y gcc make perl - name: Install opensource COBOL 4J run: | diff --git a/.github/workflows/test-other.yml b/.github/workflows/test-other.yml index 97bbb64b..55a632c5 100644 --- a/.github/workflows/test-other.yml +++ b/.github/workflows/test-other.yml @@ -26,17 +26,22 @@ jobs: with: name: opensourcecobol4j-${{ env.ARTIFACT_NAME }} + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + - name: Install dependencies on Ubuntu 22.04 if: matrix.os == 'ubuntu:22.04' run: | apt update -y - apt install -y default-jdk build-essential + apt install -y build-essential - name: Install dependencies on AlmaLinux 9 if: matrix.os == 'almalinux:9' run: | dnf -y update - dnf install -y java-17-openjdk-devel gcc make diffutils + dnf install -y gcc make diffutils - name: Install opensource COBOL 4J run: | diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 2393508c..3245ab2a 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -14,6 +14,18 @@ repositories { mavenCentral() } +tasks { + javadoc { + options.encoding = "UTF-8" + } + compileJava { + options.encoding = "UTF-8" + } + compileTestJava { + options.encoding = "UTF-8" + } +} + dependencies { implementation("com.google.guava:guava:31.1-jre") implementation("org.xerial:sqlite-jdbc:3.30.1") @@ -22,7 +34,7 @@ dependencies { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(11)) + languageVersion.set(JavaLanguageVersion.of(8)) } } diff --git a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/CobolIndexedFile.java b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/CobolIndexedFile.java index abce08d2..03373a50 100644 --- a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/CobolIndexedFile.java +++ b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/CobolIndexedFile.java @@ -256,7 +256,7 @@ public int indexed_start_internal( boolean isDuplicate = this.keys[p.key_index].getFlag() != 0; this.cursor = IndexedCursor.createCursor(p.connection, p.key, p.key_index, isDuplicate, cond); - if (this.cursor.isEmpty()) { + if (!this.cursor.isPresent()) { return COB_STATUS_30_PERMANENT_ERROR; } @@ -316,25 +316,25 @@ public int readNext(int readOpts) { if (this.indexedFirstRead || this.flag_begin_of_file) { this.cursor = IndexedCursor.createCursor(p.connection, p.key, p.key_index, isDuplicate, COB_GE); - if (this.cursor.isEmpty()) { + if (!this.cursor.isPresent()) { return COB_STATUS_10_END_OF_FILE; } this.cursor.get().moveToFirst(); } else if (this.flag_end_of_file) { this.cursor = IndexedCursor.createCursor(p.connection, p.key, p.key_index, isDuplicate, COB_LE); - if (this.cursor.isEmpty()) { + if (!this.cursor.isPresent()) { return COB_STATUS_30_PERMANENT_ERROR; } this.cursor.get().moveToLast(); } else if (this.updateWhileReading) { this.updateWhileReading = false; - if (this.cursor.isEmpty()) { + if (!this.cursor.isPresent()) { return COB_STATUS_30_PERMANENT_ERROR; } IndexedCursor oldCursor = this.cursor.get(); Optional newCursor = oldCursor.reloadCursor(); - if (newCursor.isEmpty()) { + if (!newCursor.isPresent()) { this.cursor = Optional.of(oldCursor); } else { oldCursor.close(); @@ -342,7 +342,7 @@ public int readNext(int readOpts) { } } - if (this.cursor.isEmpty()) { + if (!this.cursor.isPresent()) { return COB_STATUS_30_PERMANENT_ERROR; } @@ -361,7 +361,7 @@ public int readNext(int readOpts) { this.indexedFirstRead = false; - if (optionalResult.isEmpty()) { + if (!optionalResult.isPresent()) { return COB_STATUS_10_END_OF_FILE; } else { FetchResult result = optionalResult.get(); diff --git a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java index d919bae0..98d95054 100644 --- a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java +++ b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java @@ -128,7 +128,7 @@ public static Optional createCursor( IndexedCursor cursor = new IndexedCursor(conn, key, tableIndex, isDuplicate, comparator); cursor.forwardCursor = getCursor(conn, key, tableIndex, isDuplicate, comparator, true); cursor.backwardCursor = getCursor(conn, key, tableIndex, isDuplicate, comparator, false); - if (cursor.forwardCursor.isEmpty() || cursor.backwardCursor.isEmpty()) { + if (!cursor.forwardCursor.isPresent() || !cursor.backwardCursor.isPresent()) { return Optional.empty(); } else { return Optional.of(cursor); @@ -178,14 +178,14 @@ public Optional reloadCursor() { Optional reFetchResult = reFetch(this.conn, this.tableIndex, this.isDuplicate, result); - if (!reFetchResult.isEmpty()) { + if (reFetchResult.isPresent()) { FetchResult r = reFetchResult.get(); newCursor.forwardBuffer.add(r); newCursor.cursorIndex = 0; newCursor.firstFetch = false; } - if (newCursor.forwardCursor.isEmpty() || newCursor.backwardCursor.isEmpty()) { + if (!newCursor.forwardCursor.isPresent() || !newCursor.backwardCursor.isPresent()) { return Optional.empty(); } else { return Optional.of(newCursor); @@ -409,7 +409,7 @@ private Optional fetchPrev(ResultSet cursor) { * return Optional.empty() */ public Optional next() { - if (this.forwardCursor.isEmpty()) { + if (!this.forwardCursor.isPresent()) { return Optional.empty(); } ResultSet cursor = this.forwardCursor.get(); @@ -458,7 +458,7 @@ public Optional next() { * return Optional.empty() */ public Optional prev() { - if (this.backwardCursor.isEmpty()) { + if (!this.backwardCursor.isPresent()) { return Optional.empty(); } ResultSet cursor = this.backwardCursor.get(); @@ -524,7 +524,7 @@ private static Optional getCursor( boolean forward) { final Optional optionalCompOperator = getCompOperator(comparator, forward); - if (optionalCompOperator.isEmpty()) { + if (!optionalCompOperator.isPresent()) { return Optional.empty(); } @@ -617,7 +617,7 @@ private Optional getCursorForFirstLast( public boolean moveToFirst() { Optional cursor = getCursorForFirstLast(this.tableIndex, this.isDuplicate, CursorReadOption.FIRST); - if (cursor.isEmpty()) { + if (!cursor.isPresent()) { return false; } this.forwardCursor = cursor; @@ -630,7 +630,7 @@ public boolean moveToFirst() { public boolean moveToLast() { Optional cursor = getCursorForFirstLast(this.tableIndex, this.isDuplicate, CursorReadOption.LAST); - if (cursor.isEmpty()) { + if (!cursor.isPresent()) { return false; } this.backwardCursor = cursor;