Patterns Plugin (5.5.0): PARSER MSG [Invalid Entity Encoding in String] LEXICAL SCANNER MSG [No Lexical Scan Message.] when fetching records from Pattern server using BW (6.5.1).

Patterns Plugin (5.5.0): PARSER MSG [Invalid Entity Encoding in String] LEXICAL SCANNER MSG [No Lexical Scan Message.] when fetching records from Pattern server using BW (6.5.1).

book

Article ID: KB0075372

calendar_today

Updated On:

Products Versions
TIBCO MDM -

Description

The user is querying patterns server using BW patterns plugin to search the records in pattern server using predicate expression. While querying if one of query parameter is containing "&"  then it is failing  and showing below exception:
================

<ns0:PatternsPluginException xmlns:ns0="http://xmlns.tibco.com/bw/patterns">
  <ns0:msg>Patterns Server returned an error. -{ActivityName=query, ProcessName=javapattern.Process, ModuleName=JAVAPATTERN}</ns0:msg>
  <ns0:msgCode>TIBCO-BW-SR-PATTERNS-500006</ns0:msgCode>
  <ns0:serverMsg>Error in Predicate string.  See error info item.</ns0:serverMsg>
  <ns0:serverCode>37</ns0:serverCode>
  <ns0:serverErrorDetails>PARSER MSG [No Such Binary Operator is Defined.] LEXICAL SCANNER MSG [No Lexical Scan Message.] LAST TOKEN PARSED [&amp;] POSITION: 3 FULL EXPRESSION [16&amp;30]</ns0:serverErrorDetails>
</ns0:PatternsPluginException>

Patterns Server returned an error. -{ActivityName=query, ProcessName=javapattern.Process, ModuleName=JAVAPATTERN}, code: TIBCO-BW-SR-PATTERNS-500006, message: Patterns Server returned an error. -{ActivityName=query, ProcessName=javapattern.Process, ModuleName=JAVAPATTERN}, fault-code: null, fault-msg: null, server-code: 37, server-msg: Error in Predicate string.  See error info item., server details: PARSER MSG [No Such Binary Operator is Defined.] LEXICAL SCANNER MSG [No Lexical Scan Message.] LAST TOKEN PARSED [&] POSITION: 3 FULL EXPRESSION [16&30], line: null, charpos: null

==================
So, BW is throwing above exception while parsing XML in query activity.
 

Environment

Product: TIBCO MASTER DATA MANAGEMENT Version: 9.1.2 Pattern Server: 5.5.0 BW: 6.5.1 OS:ALL

Resolution

To resolve the issue, need to use java class which encodes the HTML '&' to '&amp;'. I have attached the sample project for reference.

The exact working is as below:

Applied HTML encoding that converts & to &amp; achieved using java class, then internally, XML apply encoding to &amp; and gives &amp;amp;. Then BW stores &amp;amp; in its internal XML message.

When plugin receives XML message(query activity), XML decoding is applied, and plugin uses &amp; and it's 16&amp;30 string value. So plugin sends 16&amp;30 to Patterns server (in the predicate expression).

Finally, the Patterns server applies HTML decoding, getting back to the original 16&30 and able to get the output from the pattern server.

Note: The issue is with Predicate Expression(exact match)only not with other querylet(Simple, Data, Variable Attributes, Cognate).
 

Issue/Introduction

Patterns Plugin (5.5.0): PARSER MSG [Invalid Entity Encoding in String] LEXICAL SCANNER MSG [No Lexical Scan Message.] when fetching records from Pattern server using BW (6.5.1).

Attachments

Patterns Plugin (5.5.0): PARSER MSG [Invalid Entity Encoding in String] LEXICAL SCANNER MSG [No Lexical Scan Message.] when fetching records from Pattern server using BW (6.5.1). get_app