not able to read binary property | Community
Skip to main content
sreenu539
Level 7
March 27, 2023
Solved

not able to read binary property

  • March 27, 2023
  • 1 reply
  • 865 views

I am trying to read a "binary" type property value with below code.

resourceToRead.getValueMap().get("allFundsDup", Property.class).getBinary();

Here is the error I am getting.

result = {BinaryImpl@30400} Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate org.apache.jackrabbit.oak.plugins.value.jcr.BinaryImpl.toString() value = {ValueImpl@30402} Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate org.apache.jackrabbit.oak.plugins.value.jcr.ValueImpl.toString()

 

If I evaluate below code, it returns original stream.

resourceToRead.getValueMap().get("allFundsDup", Property.class).getBinary().getStream();

 

what I don't understand is if stream is retrievable , why does first snippet not retrieving Binary object and giving an exception.

also when I try getValueMap().get("allFundsDup", Binary.class) same exception occurs.

 

Any inputs to understand above code.

 

Thanks,

Sri

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ashwin_Raju

Can you try the following way to return the data stream,

 

InputStream inputStream = ResourceUtil.getValueMap(resourceToRead).get("allFundsDup", InputStream .class);

 

Thanks,

Ashwin Raju

1 reply

Ashwin_RajuAccepted solution
Level 3
March 28, 2023

Can you try the following way to return the data stream,

 

InputStream inputStream = ResourceUtil.getValueMap(resourceToRead).get("allFundsDup", InputStream .class);

 

Thanks,

Ashwin Raju