Skip to content

Commit 7f86b33

Browse files
author
rathnapandi
committed
- #474
1 parent 881b079 commit 7f86b33

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1414
- Issues exporting and importing an API (See issue [#460](https://github.com/Axway-API-Management-Plus/apim-cli/issues/460))
1515
- Error importing APIs with inbound OAuth (See issue [#459](https://github.com/Axway-API-Management-Plus/apim-cli/issues/459))
1616
- Deleting a V-Host is not considered as a modification (See issue [#457](https://github.com/Axway-API-Management-Plus/apim-cli/issues/457))
17+
- NullPointerException Error when importing a new API with system quotas (See issue [#474](https://github.com/Axway-API-Management-Plus/apim-cli/issues/474))
1718
### Added
1819
- Support Feb 2024 APIM Release (See issue [#461](https://github.com/Axway-API-Management-Plus/apim-cli/issues/461))
1920

modules/apis/src/main/java/com/axway/apim/apiimport/actions/APIQuotaManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,13 @@ public void populateMethodId(API createdAPI, List<QuotaRestriction> mergedRestri
126126
if (restriction.getMethod().equals("*")) continue;
127127
// Additionally, we have to change the methodId
128128
// Load the method for actualAPI to get the name of the method to which the existing quota is applied to
129-
APIMethod actualMethod = methodAdapter.getMethodForId(actualState.getId(), restriction.getMethod());
130-
// Now load the new method based on the name for the createdAPI
131-
APIMethod newMethod = methodAdapter.getMethodForName(createdAPI.getId(), actualMethod.getName());
132-
// Finally modify the restriction
133-
restriction.setMethod(newMethod.getId());
129+
if (actualState != null) {
130+
APIMethod actualMethod = methodAdapter.getMethodForId(actualState.getId(), restriction.getMethod());
131+
// Now load the new method based on the name for the createdAPI
132+
APIMethod newMethod = methodAdapter.getMethodForName(createdAPI.getId(), actualMethod.getName());
133+
// Finally modify the restriction
134+
restriction.setMethod(newMethod.getId());
135+
}
134136
}
135137
}
136138

0 commit comments

Comments
 (0)