cancel
Showing results for 
Search instead for 
Did you mean: 

Encode method error in UDF

Former Member
0 Kudos

I have to encode an incoming url in payload

I am using this udf

public String encodeURL(String str, Container container) throws StreamTransformationException{

try {

        return URLEncoder.encode(str, "UTF-8");

    } catch (UnsupportedEncodingException e) {

        return str;

    }

My UDF title is encodeURL

Execution type single values

Under Signature variables

Type Argument  Name str Java Type String

I am getting this error

cannot find Symbol

symbol : variable URLEncoder

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Midhun,

You just need to add the class in import section like below.

Regards,

Praveen.

Former Member
0 Kudos

Thanks a lot Praveen. It's working fine now.

Answers (1)

Answers (1)

manoj_khavatkopp
Active Contributor
0 Kudos

Hi Midhun,

Have you imported the required jars in Message Mapping ?

Regards,

Manoj