ews-java-api icon indicating copy to clipboard operation
ews-java-api copied to clipboard

Potential Class Type Incorrectly Set to Byte[] instead of byte[] in MapiTypeConverter.java

Open timpei opened this issue 5 years ago • 1 comments

Hi,

I'm currently attempting to send an Message with ExtendedPropertyDefintions. In the case where the MapiPropertyType is Binary, the value never gets assigned due to the code below:

https://github.com/OfficeDev/ews-java-api/blob/33235f37d97871f17c496526aad0b8c458f904c3/src/main/java/microsoft/exchange/webservices/data/misc/MapiTypeConverter.java#L79

Here's a snippet of how to reproduce it: ExtendedPropertyDefinition replyRecipientEntries = new ExtendedPropertyDefinition(0x004F, MapiPropertyType.Binary); byte[] entriesByteArray = Hex.decodeHex("test data"); message.setExtendedProperty(replyRecipientEntries, entriesByteArray); The result will have value set as null for this property.

If we pass in Byte[], it triggers an error here, when attempting to convert to string value. This causes a cast error from Byte[] to byte[].

Is this considered an issue? Have anyone else successfully assigned a value to an ExtendedPropertyDefinition with type MapiPropertyType.Binary?

timpei avatar Oct 04 '19 03:10 timpei

It's a bug in the library. I made a fix here: https://github.com/FacilityNet/ews-java-api/commit/d13f40763be6667ca6e84183b79769710083707f

soerenBoisen avatar Feb 07 '20 10:02 soerenBoisen