joniles / mpxj

Primary repository for MPXJ library

Home Page:http://www.mpxj.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ProjectProperties.getCustomProperties() can return null

JanecekPetr opened this issue · comments

Hello!

It's unclear to me whether this behavior is intentional or not, but project.getProjectProperties().getCustomProperties() can return null (it's coming from a P6 XML file with no ScheduleOptions).

It's generally unexpected to see nulls from methods returning collections or maps as an empty collection/map tends to be the default unless there is a semantic difference between empty and missing return value.

Is there a difference in this case? I don't know. Either way, if there is a difference and null means something different from an empty map, I'd like it to be explicitly stated in the docs. If there is no difference, it would make sense to me to return an empty map instead.

What do you think?

@JanecekPetr thanks for the note. I've updated the implementation to ensure that you'll always get a Map instance back, regardless of whether any custom properties have been configured. These changes will be part of the next MPXJ release.

New version available now with this change.