FieldHelper cannot be cast to java.lang.String pentaho

I had the following error in a “User Defined Java Class” step on Pentaho Data Integration.

FieldHelper cannot be cast to java.lang.String

Indeed, you have to use the getRow() method to convert the field you’re getting into a String or any other variable type.

public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException, Exception
{
  Object[] r = getRow();
        if (r == null) { return false; }
        String myString = get(Fields.In, "FeedSubmissionId").getString(r);
}