Bug 1328838

Summary: Pre-processing Example
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Muthu <muthiah.amma90>
Component: doc-Smooks_GuideAssignee: David Le Sage <dlesage>
Status: CLOSED EOL QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 5.3.1CC: soa-p-jira
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Instance Name: Not Defined Build: CSProcessor Builder Version 1.7 Build Name: 9506, Smooks User Guide-5-5.3.1 Build Date: 06-02-2013 10:31:47
Last Closed: 2017-11-10 04:33:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Muthu 2016-04-20 11:56:46 UTC
Description of problem:

I need to have a bean to decode string value.Before decoding it needs to replace the apostrophie contents.The variable firstname is a string

How to preform this action.
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
      xmlns:json="http://www.milyn.org/xsd/smooks/json-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd"
      xmlns:g="http://www.milyn.org/xsd/smooks/groovy-1.1.xsd">

<jb:bean beanId="insuredPersonName"
            class="com.cognizant.insurance.general.domain.party.partyname.PersonName"
            createOnElement="Insured BasicDetails">
            <jb:value property="title" data="Insured BasicDetails salutation" />
            <jb:value property="givenName" data="Insured BasicDetails firstName" decoder="String">
            <jb:decodeParam name="valuePreprocess">
            value=value.replace("'","&#39;")
                                              </jb:decodeParam>
                          </jb:value>
            <jb:value property="surname" data="Insured BasicDetails lastName" />
            <jb:wiring property="transTrackingId" beanIdRef="transTrackingID" />
      </jb:bean>
</smooks-resource-list>
The above Code Throws below error:-

Caused by: org.milyn.SmooksException: Failed to filter source.
	at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:97)
	at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:64)
	at org.milyn.Smooks._filter(Smooks.java:526)
	at org.milyn.Smooks.filterSource(Smooks.java:482)
	at com.cognizant.insurance.general.core.smooks.LifeEngageSmooksHolder.parseJson(LifeEngageSmooksHolder.java:138)
	... 91 more
Caused by: org.milyn.SmooksException: Error in 'org.milyn.smooks.scripting.groovy.SmooksVisitor_27015246_7' while processing the visitAfter event.
	at org.milyn.delivery.sax.SAXHandler.processVisitorException(SAXHandler.java:573)
	at org.milyn.delivery.sax.SAXHandler.processVisitorException(SAXHandler.java:559)
	at org.milyn.delivery.sax.SAXHandler.visitAfter(SAXHandler.java:396)
	at org.milyn.delivery.sax.SAXHandler.endElement(SAXHandler.java:204)
	at org.milyn.delivery.SmooksContentHandler.endElement(SmooksContentHandler.java:96)
	at org.milyn.json.JSONReader.endElement(JSONReader.java:389)
	at org.milyn.json.JSONReader.endElement(JSONReader.java:385)
	at org.milyn.json.JSONReader.parse(JSONReader.java:299)
	at org.milyn.delivery.sax.SAXParser.parse(SAXParser.java:76)
	at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:86)
	... 95 more
Caused by: java.lang.IllegalArgumentException: null 'bean' arg in method call.
	at org.milyn.assertion.AssertArgument.isNotNull(AssertArgument.java:42)