Skip to content

Commit

Permalink
Code fixes based on CodeQL feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Ryniewicz <[email protected]>
  • Loading branch information
michalryn committed Jan 22, 2025
1 parent 3af9999 commit 58ed107
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions CLI/src/main/java/backend/FileDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ private void downloadFile() {
for (File tempFile : tempFiles) {
Files.deleteIfExists(tempFile.toPath());
}
for (FileOutputStream fileOutputStream : fileOutputStreams) {
fileOutputStream.close();
}
fileOutputStreams.stream().close();
} else {
InputStream urlStream = url.openStream();
readableByteChannel = Channels.newChannel(urlStream);
Expand Down
3 changes: 2 additions & 1 deletion Core/src/main/java/utils/DbConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void createTables() throws SQLException {
String createSessionTableQuery = "CREATE TABLE IF NOT EXISTS SESSION (Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, StartDate TEXT NOT NULL, EndDate TEXT);";
String createFileTableQuery = "CREATE TABLE IF NOT EXISTS FILE (Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, FileName TEXT NOT NULL, Url TEXT NOT NULL, SaveTargetPath TEXT NOT NULL, Size INTEGER, DownloadStartTime TEXT, DownloadEndTime TEXT, State INTEGER NOT NULL, SessionId INTEGER NOT NULL, FOREIGN KEY(SessionId) REFERENCES Session(Id));";
try (PreparedStatement createSessionTableStatement = connection.prepareStatement(createSessionTableQuery);
PreparedStatement createFileTableStatement = connection.prepareStatement(createFileTableQuery)) {
PreparedStatement createFileTableStatement = connection.prepareStatement(createFileTableQuery))
{
createSessionTableStatement.executeUpdate();
createFileTableStatement.executeUpdate();
}
Expand Down

0 comments on commit 58ed107

Please sign in to comment.