Summary: | Issue related to ClassCastException which we are facing while using poi-4.0.1 along with java 11. | ||
---|---|---|---|
Product: | POI | Reporter: | Sushmita Nag <snag> |
Component: | HPSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: | Issue related to ClassCastException which we are facing while using poi-4.0.1 along with java 11 |
Description
Sushmita Nag
2019-04-10 08:16:49 UTC
Hi Sushmita, please also upload your example file otherwise we can't validate/fix this issue. Andi Created attachment 36517 [details]
Issue related to ClassCastException which we are facing while using poi-4.0.1 along with java 11
Code causing classcastexception: CustomProperty property = (CustomProperty) e.getValue(); CustomProperties newCustomProperties = dsi.getCustomProperties(); Iterator iterator = customProperties.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry e = (Map.Entry) iterator.next(); CustomProperty property = (CustomProperty) e.getValue(); String name = property.getName(); Object oldValue = property.getValue(); } hi Andrea, Could you please provide us information on the same ? Regards, Sushmita Sushmita - where does the code from your comment of 2019-04-10 09:43:14 UTC come from? If it is your code, then you shouldn't be doing a class cast. You should check if the value is an instanceof CustomProperty before casting it. From the JavaDoc of CustomProperties: While this class is roughly HashMap<Long,CustomProperty>, that's the internal representation. To external calls, it should appear as HashMap<String,Object> mapping between Names and Custom Property Values. I think, this is enough explaining the error - I'm closing this now as "invalid". |