Question

2
Replies
1077
Views
AnnemarieZ Member since 2013 5 posts
msg systems
Posted: 4 years ago
Last activity: 4 years 4 months ago
Closed
Solved

JSONStream.parseJSONStream(String) throw an error, but jsonString has the correct Format

In our application we have a own Functionrule. This Function worked on Pega 6.3 without error,
but in Pega 7.1.7 it throws an error in the trace.
In this Functionrule we have the following Java-Code:

//**********BEGIN*****************************************************************************************
PublicAPI tools = ThreadContainer.get().getPublicAPI();

ClipboardPage resultPage = tools.createPage("AzD-Int-EncryptionFW-Result", "encryptionResultPage");
ClipboardPage configPage;
ClipboardPage decryptedDataPage;
Cipher cipher;
MessageDigest messageDigest;
try {
    //-- Is the property encrypted by this?
    try {
  String jsonString = Base64Util.decode(property);
        resultPage.putString("Message", jsonString);
        decryptedDataPage = tools.createPage("AzD-Int-EncryptionFW", "decryptedDataPage");      
  //the next line cause very probably the error
  decryptedDataPage.adoptJSONObject(jsonString);

  //.... further Code, but not important for this request
//****************************************************************************************************** 

When the function is executed, it throws the following ErrorCode in the trace:

Invalid clipboard stream detected in module
com.pega.pegarules.data.internal.clipboard.JSONStream.parseJSONStream(String).
Reason: JSON text must start with '{' or '[' at 0 [character 1 line 1]

The function call the Method adoptJSONObject(jsonString). The value of the jsonString is in this case:

{ "AzDIntEncryptionFWEncryptedData":"Duo2EZA5o8iEJobDMMZFaOlE6LCyyasza+j+MVRP2cY=" ,
"AzDIntEncryptionFWEncryptionTimeStamp":"20160525T093142.110 GMT" ,
"AzDIntEncryptionFWMD5Checksum":"q/DI0a9pPJ1k2qvc3lQ5zQ==" ,
"pxObjClass":"AzD-Int-EncryptionFW" }

The jsonString begin with a "{" but the errormessage told the sign "{" is missing.

I believe the method adoptJSONObject cause the error and has maybe an mistake.

Can you help us, that we get no error more in the trace?

Moderation Team has archived post
Share this page LinkedIn