Zsihovszki Krisztina created NIFI-11158:
-------------------------------------------

             Summary: PutSalesforceObject processor improvements
                 Key: NIFI-11158
                 URL: https://issues.apache.org/jira/browse/NIFI-11158
             Project: Apache NiFi
          Issue Type: Improvement
    Affects Versions: 1.20.0
            Reporter: Zsihovszki Krisztina


Found a few minor issues while checking PutSalesforceObject processor in the 
scope of NiFi 1.20 RC1 validation.

 
 * The session.penalize call is missing when flowfile is routed to FAILURE 
relationship.
 * It would be also useful if an "error.message" attribute was put on the 
outgoing flowfile containing info about the occurred error.
 * No provenance event is generated for successful put actions.
 * SeeAlso tags are missing (there is also a QuerySalesforceObject processor).

 

I used an already fetched Salesforce record for testing. It contained null 
fields. When tried to upload that record (with a new name) to Salesforce, I got 
an NPE (flowfile was routed to FAILURE):

 
{code:java}
2023-02-09 10:12:47,176 ERROR [Timer-Driven Process Thread-2] 
o.a.n.p.salesforce.PutSalesforceObject 
PutSalesforceObject[id=351e77fb-0186-1000-2c1f-d14e9aad775b] Failed to put 
records to Salesforce.
java.lang.NullPointerException: null
        at java.base/java.util.Objects.requireNonNull(Objects.java:221)
        at 
java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:178)
        at 
java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at 
java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at 
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at 
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at 
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at 
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at 
java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at 
org.apache.nifi.processors.salesforce.util.RecordExtender.getExtendedRecord(RecordExtender.java:71)
        at 
org.apache.nifi.processors.salesforce.PutSalesforceObject.onTrigger(PutSalesforceObject.java:164)
{code}

I believe it is not a common use case to upload a record with null value field 
but the code might be improved filter out/ignore null value fields and handle 
this situation without error.

 

A short example to reproduce the above error with NPE (it's a BusinessBrand 
object).


{code:java}
{
  "Name": "=p'C!QWv",
  "OrgId": "S/}[R\"Tf",
  "ParentId": null
}{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to