Skip to content

PUT {management}/v4/assets requires data address #5708

@smanolloff

Description

@smanolloff

Bug Report

Describe the Bug

The Asset V4 API fails with HTTP 500 if trying to update an asset without supplying a valid data address.

Expected Behavior

No error raised. The Data address in the Asset should not be mandatory.

Observed Behavior

HTTP error 500. Server logs:

JerseyExtension: Unexpected exception caught
java.lang.NullPointerException: Cannot invoke "org.eclipse.edc.spi.types.domain.DataAddress.getType()" because "dataAddress" is null
	at org.eclipse.edc.connector.core.validator.DataAddressValidatorRegistryImpl.validateSource(DataAddressValidatorRegistryImpl.java:49)
	at org.eclipse.edc.connector.controlplane.services.asset.AssetServiceImpl.update(AssetServiceImpl.java:121)
	at org.eclipse.edc.connector.controlplane.api.management.asset.BaseAssetApiController.updateAsset(BaseAssetApiController.java:121)
	at org.eclipse.edc.connector.controlplane.api.management.asset.v4.AssetApiV4Controller.updateAssetV4(AssetApiV4Controller.java:80)
...

Steps to Reproduce

  1. Create an asset
curl -v --url "<management_url>/v4/assets" -X POST --json '{
      "@context": ["https://w3id.org/edc/connector/management/v2"],
      "@id": "test-asset",
      "@type": "Asset",
      "properties": {}
  }'
  1. Try to update the asset and observe error response (HTTP 500):
curl -v --url "<management_url>/v4/assets" -X PUT --json '{
      "@context": ["https://w3id.org/edc/connector/management/v2"],
      "@id": "test-asset",
      "@type": "Asset",
      "properties": {}
  }'
  1. Retry update, this time with a data address and observe successful response (HTTP 204):
curl -v --url "<management_url>/v4/assets" -X PUT --json '{
      "@context": ["https://w3id.org/edc/connector/management/v2"],
      "@id": "test-asset",
      "@type": "Asset",
      "properties": {},
      "dataAddress": {"type": "DataAddress"}
  }'

Context Information

EDC v0.17.0 / 737bfc9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions