contentful/contentful.java

name is always null in CDATag

Closed this issue · 2 comments

Version: Java SDK - 10.5.4

Had a content linked to a public tag. When retrieved thriugh CDA API, the name in CDATag.java is always null
tag.attrs() returns {type=Link, linkType=Tag, id=filterLinearOnlySchedules}

Also when you do a toString() on CDATag, it throws IllegalArgumentException in CDAResource class as there is no Enum constant defined with value LINK but tag is marked as type LINK in contentful

  public CDAType type() {
    String type = getAttribute("type");
    return CDAType.valueOf(type.toUpperCase(LOCALE)); - IllegalArgumentException as type is 'Link' for tags
  }

Hey @dhanabal-sky,

can you please share code snippet that triggers this error?

name field will be null when looking at metadata in fetching content call - here is some example response - https://www.contentful.com/developers/docs/references/content-preview-api/#/reference/content-tags/content-tags-on-entries-and-assets/get-a-single-entry/console/curl

toString() indeed has an error, which will be fixed in the next release.

In order to get name of the tag you need to call this one - https://www.contentful.com/developers/docs/references/content-preview-api/#/reference/content-tags/tag/get-a-single-tag/console/curl

Closing for now.