Skip to content

Commit c32db76

Browse files
author
Chris Wiechmann
committed
#114 Avoid NPE, if desired API doesn't have Client-Apps or -Orgs
1 parent e73d509 commit c32db76

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.axway.apim.apiimport.actions;
22

33
import java.util.ArrayList;
4-
import java.util.List;
54

65
import org.slf4j.Logger;
76
import org.slf4j.LoggerFactory;
@@ -26,12 +25,12 @@ public void execute(APIChangeState changes) throws AppException {
2625
Mode clientAppsMode = CoreParameters.getInstance().getClientAppsMode();
2726
Mode clientOrgsMode = CoreParameters.getInstance().getClientOrgsMode();
2827
// Get existing Orgs and Apps, as they will be lost when the API gets unpublished
29-
if(clientAppsMode==Mode.add && actualAPI.getApplications()!=null) {
28+
if(clientAppsMode==Mode.add && actualAPI.getApplications()!=null && changes.getDesiredAPI().getApplications()!=null) {
3029
changes.getDesiredAPI().getApplications().addAll(actualAPI.getApplications());
3130
// Reset the applications to have them re-created
3231
actualAPI.setApplications(new ArrayList<ClientApplication>());
3332
}
34-
if(clientOrgsMode==Mode.add && actualAPI.getClientOrganizations()!=null) {
33+
if(clientOrgsMode==Mode.add && actualAPI.getClientOrganizations()!=null && changes.getDesiredAPI().getClientOrganizations()!=null) {
3534
// Take over existing organizations
3635
changes.getDesiredAPI().getClientOrganizations().addAll(actualAPI.getClientOrganizations());
3736
// Delete them, so that they are re-created

0 commit comments

Comments
 (0)