Question

31
Views
Close popover
Terence Yuen (TerenceY0215)
Bank of Nova Scotia

Bank of Nova Scotia
CA
TerenceY0215 Member since 2016 33 posts
Bank of Nova Scotia
Posted: October 20, 2020
Last activity: November 17, 2020

Repository API - pyStream Property - Got InvalidJavaObjectClass Message

I am trying to build a Custom Repository with the 7.4+ Repository API.   I am calling a REST services that returns a application-octet stream.  With that, I have mapped the response to a property of Java Object type.

In the Response Data Transform ( of class Embed-Repository-File), I have something like the following:

.pyStream = @MyFunction(.mySourceJavaObjectProperty)

 

My Functions looks something like this:

byte[] byteArray = null; 

try {    byteArray =  (byte[]) object; } catch (Exception e)  {    byteArray =  ((String)object).getBytes(); }

java.io.InputStream is = (java.io.InputStream) (new java.io.ByteArrayInputStream(byteArray)); return is;

 

With the line in the Data Transform, I was getting a warning message like this in the Tracer:

 

(Embed-Repository-File)InvalidJavaObjectClass java.io.ByteArrayInputStream java.io.InputStream

 

If I use the ClipboardPage putObject Engine API method, I won't get this warning.  

 

Is there something that I did wrong here?  I have already casted the object as an InputStream in the function.   Alternatively, is there a better way to create an InputStream object from a byte array?

 

I am on Pega 7.4.

 

 

***Edited by Moderator Marissa to update Content Type from Discussion to Question***
Pega Platform 7.4 Data Integration Java and Activities Financial Services Lead System Architect