Skip to content

Commit ae97dc4

Browse files
Fixed issue with PR#1126 where compilation+unit tests failed with UnsupportedOperation (#1129)
1 parent 6e94919 commit ae97dc4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/applications/DefaultApplications.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -790,13 +790,11 @@ private static Mono<String> getApplicationId(CloudFoundryClient cloudFoundryClie
790790
return requestApplications(cloudFoundryClient, manifest.getName(), spaceId)
791791
.singleOrEmpty()
792792
.flatMap(application -> {
793-
Map<String, Object> entityEnvironmentJsons = ResourceUtils.getEntity(application).getEnvironmentJsons();
794-
Map<String, Object> environmentJsons = Optional
795-
.ofNullable(entityEnvironmentJsons)
796-
.orElse(Collections.emptyMap());
797-
Optional.ofNullable(manifest.getEnvironmentVariables()).ifPresent(environmentJsons::putAll);
793+
HashMap<String, Object> merge = new HashMap<>();
794+
Optional.ofNullable(ResourceUtils.getEntity(application).getEnvironmentJsons()).ifPresent(merge::putAll);
795+
Optional.ofNullable(manifest.getEnvironmentVariables()).ifPresent(merge::putAll);
798796

799-
return requestUpdateApplication(cloudFoundryClient, ResourceUtils.getId(application), environmentJsons, manifest, stackId)
797+
return requestUpdateApplication(cloudFoundryClient, ResourceUtils.getId(application), merge, manifest, stackId)
800798
.map(ResourceUtils::getId);
801799
})
802800
.switchIfEmpty(requestCreateApplication(cloudFoundryClient, manifest, spaceId, stackId)

cloudfoundry-operations/src/test/java/org/cloudfoundry/operations/applications/DefaultApplicationsTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,7 @@ public void pushExistingApplicationWithNullEnvironment() throws IOException {
14421442
.manifest(ApplicationManifest.builder()
14431443
.path(testApplication)
14441444
.domain("test-shared-domain")
1445+
.environmentVariable("test-key-1", "test-value-1")
14451446
.environmentVariable("test-key-2", "test-value-2")
14461447
.name("test-name")
14471448
.build())

0 commit comments

Comments
 (0)