Question
msg systems
DE
Last activity: 31 May 2016 11:09 EDT
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:
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?