Skip to content

Commit 5e1bcaf

Browse files
author
Chris Wiechmann
committed
Avoid NPE if actualApp has no existing Scopes
#206
1 parent 965fcbf commit 5e1bcaf

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
### Fixed
1616
- Changed the Log-Threshold to DEBUG for Console-Logger to make debugging working according to the documentation
1717
- Application-JSON-Export - Credentials should not contain ApplicationID (See issue [#146](https://github.com/Axway-API-Management-Plus/apim-cli/issues/146))
18+
- Import Application scopes doesn't work (See issue [#206](https://github.com/Axway-API-Management-Plus/apim-cli/issues/206))
1819

1920
## [1.3.10] 2021-07-16
2021
### Fixed

modules/apim-adapter/src/main/java/com/axway/apim/adapter/clientApps/APIMgrAppsAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,6 @@ private void deleteOAuthResources(ClientApplication desiredApp, List<ClientAppOa
637637

638638
private void getScopes2AddOrUpdate(ClientApplication actualApp, ClientApplication desiredApp,
639639
List<ClientAppOauthResource> scopes2Update, List<ClientAppOauthResource> scopes2Create, List<ClientAppOauthResource> scopes2Delete) throws AppException {
640-
if((desiredApp.getOauthResources()==null || desiredApp.getOauthResources().size()==0) &&
641-
(actualApp.getOauthResources()==null || actualApp.getOauthResources().size()==0)) return;
642640
List<ClientAppOauthResource> existingScopes = null;
643641
List<ClientAppOauthResource> desiredScopes = desiredApp.getOauthResources();
644642
if(actualApp!=null) {
@@ -667,7 +665,9 @@ private void getScopes2AddOrUpdate(ClientApplication actualApp, ClientApplicatio
667665
}
668666
if(!existingScopeFound) scopes2Create.add(desiredScope);
669667
}
670-
// finally iterate over all existing scopes and check if they are still desired
668+
}
669+
// finally iterate over all existing scopes and check if they are still desired
670+
if(existingScopes!=null) {
671671
for(ClientAppOauthResource existingScope : existingScopes) {
672672
boolean actualScopeFound = false;
673673
for(ClientAppOauthResource desiredScope : desiredScopes) {

0 commit comments

Comments
 (0)