From 9d3c40d574627341d777f4eb50072f227493d91c Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Wed, 6 Nov 2024 15:36:40 +0100 Subject: [PATCH] improved logging for realm retrieval errors --- CHANGELOG.md | 2 ++ .../keycloak/config/service/checksum/ChecksumService.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62985bc76..01b306fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- improved logging for realm retrieval errors [#1010](https://github.com/adorsys/keycloak-config-cli/issues/1010) ### Fixed - Allow environment variables from existing secrets [#822](https://github.com/adorsys/keycloak-config-cli/issues/822) ### Fixed diff --git a/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java b/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java index 735e4b14d..92f6956f8 100644 --- a/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java +++ b/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java @@ -52,6 +52,9 @@ public ChecksumService(RealmRepository realmRepository, ImportConfigProperties i public void doImport(RealmImport realmImport) { RealmRepresentation existingRealm = realmRepository.get(realmImport.getRealm()); + if (existingRealm == null) { + throw new InvalidImportException("The specified realm does not exist: " + realmImport.getRealm()); + } Map customAttributes = existingRealm.getAttributes(); String importChecksum = realmImport.getChecksum();