From 44bf749438a3294e669ca3d7100a3967d7f23ebb Mon Sep 17 00:00:00 2001 From: MikhailSuendukov <110986399+MikhailSuendukov@users.noreply.github.com> Date: Wed, 28 Aug 2024 04:53:05 +0200 Subject: [PATCH 1/4] Fix CodeQL scan (#1736) --- .azurepipelines/publish-maven-1ES.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.azurepipelines/publish-maven-1ES.yml b/.azurepipelines/publish-maven-1ES.yml index d16bfb949..be2025bcd 100644 --- a/.azurepipelines/publish-maven-1ES.yml +++ b/.azurepipelines/publish-maven-1ES.yml @@ -31,6 +31,9 @@ extends: displayName: MacOS cancelTimeoutInMinutes: 1 templateContext: + sdl: + codeql: + language: java, python, ruby outputs: - output: pipelineArtifact displayName: 'Publish Artifact: Release' From 0a445e5a879b12fcb1f3bed6aefbdfbd2ffe6581 Mon Sep 17 00:00:00 2001 From: MikhailSuendukov <110986399+MikhailSuendukov@users.noreply.github.com> Date: Wed, 4 Sep 2024 13:17:50 +0200 Subject: [PATCH 2/4] Fix close cursor (#1737) --- .../appcenter/utils/storage/DatabaseManager.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sdk/appcenter/src/main/java/com/microsoft/appcenter/utils/storage/DatabaseManager.java b/sdk/appcenter/src/main/java/com/microsoft/appcenter/utils/storage/DatabaseManager.java index 15ab0b946..d5a4ee22e 100644 --- a/sdk/appcenter/src/main/java/com/microsoft/appcenter/utils/storage/DatabaseManager.java +++ b/sdk/appcenter/src/main/java/com/microsoft/appcenter/utils/storage/DatabaseManager.java @@ -225,13 +225,14 @@ public ContentValues deleteTheOldestRecord(@NonNull Set columnsToReturn, SQLiteQueryBuilder queryBuilder = SQLiteUtils.newSQLiteQueryBuilder(); queryBuilder.appendWhere(priorityColumn + " <= ?"); columnsToReturn.add(PRIMARY_KEY); - Cursor cursor = getCursor(queryBuilder, columnsToReturn.toArray(new String[0]), new String[]{String.valueOf(priority)}, priorityColumn + " , " + PRIMARY_KEY); - ContentValues rowData = nextValues(cursor); - if (rowData != null) { - long deletedId = rowData.getAsLong(PRIMARY_KEY); - delete(deletedId); - AppCenterLog.debug(LOG_TAG, "Deleted log id=" + deletedId); - return rowData; + try (Cursor cursor = getCursor(queryBuilder, columnsToReturn.toArray(new String[0]), new String[]{String.valueOf(priority)}, priorityColumn + " , " + PRIMARY_KEY)) { + ContentValues rowData = nextValues(cursor); + if (rowData != null) { + long deletedId = rowData.getAsLong(PRIMARY_KEY); + delete(deletedId); + AppCenterLog.debug(LOG_TAG, "Deleted log id=" + deletedId); + return rowData; + } } AppCenterLog.error(LOG_TAG, String.format("Failed to delete the oldest log from database %s.", mDatabase)); return null; From 5ed38b99180bbeb7e4d0ee0e1dfe70833b7cb94d Mon Sep 17 00:00:00 2001 From: Djordje <46656919+DordeDimitrijev@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:34:08 +0200 Subject: [PATCH 3/4] [CI] Add file with version to build artifacts (#1739) --- .azurepipelines/publish-maven-1ES.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.azurepipelines/publish-maven-1ES.yml b/.azurepipelines/publish-maven-1ES.yml index be2025bcd..05f92a056 100644 --- a/.azurepipelines/publish-maven-1ES.yml +++ b/.azurepipelines/publish-maven-1ES.yml @@ -25,10 +25,11 @@ extends: sdl: sourceAnalysisPool: 1ES-PT-Windows-2022 stages: - - stage: stage + - stage: BuildArtifacts + displayName: Build Artifacts and collect version info jobs: - - job: Phase_1 - displayName: MacOS + - job: BuildArtifacts + displayName: Build Artifacts cancelTimeoutInMinutes: 1 templateContext: sdl: @@ -74,17 +75,16 @@ extends: inputs: tasks: publish publishJUnitResults: false - - task: SFP.release-tasks.custom-build-release-task.EsrpRelease@4 - displayName: ESRP Release + - task: Bash@3 + displayName: 'Extract Version info' inputs: - ConnectedServiceName: ESRP Release - FolderLocation: $(Build.ArtifactStagingDirectory)/com/microsoft - Owners: lucen@microsoft.com - Approvers: lucen@microsoft.com - enabled: true - + targetType: 'inline' + script: | + VERSION=$(grep "versionName = '" versions.gradle | awk -F "[']" '{print $2}') + echo $VERSION > $(Build.ArtifactStagingDirectory)/com/microsoft/version + - stage: APIScan - dependsOn: Stage + dependsOn: BuildArtifacts pool: name: 1ES-PT-Windows-2022 os: windows From f8d9bf7e800943b58533c5db078c27380a821b8c Mon Sep 17 00:00:00 2001 From: Djordje Dimitrijev Date: Mon, 16 Sep 2024 11:24:06 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1831018..f3210773e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### AppCenter +* **[Fix]** Fix closing cursor after deleting old records. * **[Improvement]** Use java.security.Random instead of java.util.Random. ### App Center Crashes