leshan: DDFFileParser does not handle resource without a data type ("none")

The specifications of both LWM2M 1.0 and 1.1 have normative listings of resources’ data type. There’s a “none” entry in that listing, which states

No specific data type affected to that resource: it exclusively concerns Executable Resource.

When reading resource model definitions using DDFFileParser, and the resource is specified with <Type></Type>, that resource model still gets Type.STRING as type.

See https://github.com/eclipse/leshan/blob/dea23774923a2abfb09968128802ce3fcde0ab4b/leshan-core/src/main/java/org/eclipse/leshan/core/model/DDFFileParser.java#L134 for the implicit default case, and https://github.com/eclipse/leshan/blob/dea23774923a2abfb09968128802ce3fcde0ab4b/leshan-core/src/main/java/org/eclipse/leshan/core/model/DDFFileParser.java#L158-L180 for the switch case which we “fallthrough” with an empty type.

I would expect either null or an explicit sentinel value such as Type.NONE, where the latter is preferred both since it avoids having to null check, and because it’s name matches the specification(s).

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

(fix integrated in master)