Skip to content

Manifest parser utility throws NPE if invoked on a relative path #766

@kdvolder

Description

@kdvolder

When we have all of the following conditions:

  • we specify a relative path to the manifest.yml
  • the relative path has only one segment (e.g. "manifest.yml" in the current dir)
  • the manifest has a path attribute

Then the parser utility crashes with NPE.

You can reproduce this problem with the test code from here:

https://github.com/kdvolder/cf-java-client-sample-v2/blob/http-endpoint-bug/src/main/java/com/github/kdvolder/cfv2sample/CFV2SampleMain.java#L83

Comment out the 'workaround' on that line. Then run the code.

You get this error:

Starting...
Using PASSWORD token for auth
Exception in thread "main" java.lang.NullPointerException
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.lambda$toApplicationManifest$10(ApplicationManifestUtils.java:230)
	at java.util.Optional.ifPresent(Optional.java:159)
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.as(ApplicationManifestUtils.java:103)
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.asString(ApplicationManifestUtils.java:156)
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.toApplicationManifest(ApplicationManifestUtils.java:230)
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.lambda$null$7(ApplicationManifestUtils.java:186)
	at java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:891)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.lambda$doRead$8(ApplicationManifestUtils.java:182)
	at java.util.Optional.ifPresent(Optional.java:159)
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.doRead(ApplicationManifestUtils.java:181)
	at org.cloudfoundry.operations.applications.ApplicationManifestUtils.read(ApplicationManifestUtils.java:70)
	at com.github.kdvolder.cfv2sample.CFV2SampleMain.pushAnApp(CFV2SampleMain.java:88)
	at com.github.kdvolder.cfv2sample.CFV2SampleMain.main(CFV2SampleMain.java:78)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions