CustomProperties supports various put methods - e.g. put(String name, Long value). Each of these calls put(CustomProperty) which calculates a unique id for the property and adds it. If you want to add a property of a custom type you can't build your own CustomProperty and call put (CustomProperty) because it is private. You can call put(name, CustomProperty) but this method doesn't allocate a unique ID. This means you need to do your own id management to ensure you assign unique IDs to every property you add. In my case I wanted to add a non unicode String property. Unfortunately put(String name, String value) sete the type to unicode, so I had to abandon all the built in simple put() methods and build my own CustomProperty objects for all attributes so that I could guarantee the IDs for them were unique.
This bug references a very old version of POI. As no new comments have been added in a long time, I'm assuming that this bug has now been fixed If the bug still exists with the latest version of POI, please re-open the bug and add a comment indicating this, ideally also with a failing unit test