Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name: Java CI

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
Expand All @@ -16,11 +17,11 @@ jobs:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: 17
distribution: 'temurin'
java-version: '17'
- name: Compile the source
run: ant -noinput -buildfile build.xml clean compile
- name: Check the code style
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ public static List<String[]> loadBytes(Dataset dataset, int bytesToRead) throws

LOG.debug("Reading bytes... " + bytesToRead);
char[] bytes = new char[bytesToRead];
BufferedReader bufferedReader = new BufferedReader(reader);
int bytesRead = bufferedReader.read(bytes);
bufferedReader.close();
LOG.debug("Bytes read: " + bytesRead);

try (BufferedReader bufferedReader = new BufferedReader(reader)) {
int bytesRead = bufferedReader.read(bytes);
LOG.debug("Bytes read: " + bytesRead);
}
result = new String(bytes);
} catch (IOException e) {
LOG.error(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,13 @@ public static String getFileChecksum(File file) {
String method = "SHA-512";
MessageDigest digest = MessageDigest.getInstance(method);

FileInputStream fis = new FileInputStream(file);
byte[] byteArray = new byte[1024];
int bytesCount = 0;
while ((bytesCount = fis.read(byteArray)) != -1) {
digest.update(byteArray, 0, bytesCount);
try (FileInputStream fis = new FileInputStream(file)) {
byte[] byteArray = new byte[1024];
int bytesCount = 0;
while ((bytesCount = fis.read(byteArray)) != -1) {
digest.update(byteArray, 0, bytesCount);
}
}
fis.close();

// Convert decimal to hexadecimal format
byte[] bytes = digest.digest();
StringBuilder sb = new StringBuilder();
Expand Down
Loading