Andy LoPresto created NIFI-4194:
-----------------------------------

             Summary: NullPointerException in InvokeHTTP processor when trusted 
hostname property is used
                 Key: NIFI-4194
                 URL: https://issues.apache.org/jira/browse/NIFI-4194
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
    Affects Versions: 1.3.0
            Reporter: Andy LoPresto


When a user configures the {{InvokeHTTP}} processor with HTTPS (using an 
{{SSLContextService}}) and populates the {{trustedHostname}} property, the 
processor will throw a {{NullPointerException}} because the OkHttp client does 
not have a valid {{HostnameVerifier}} configured when the {{@OnScheduled}} 
method is called and that verifier is delegated to the processor. This results 
in the stacktrace below:

{code}
2017-07-17 19:15:49,341 ERROR [Timer-Driven Process Thread-6] 
o.a.nifi.processors.standard.InvokeHTTP 
InvokeHTTP[id=53784003-015d-1000-ffb0-e07173729c9c] Routing to Failure due to 
exception: java.lang.NullPointerException: java.lang.NullPointerException
java.lang.NullPointerException: null
        at 
org.apache.nifi.processors.standard.InvokeHTTP$OverrideHostnameVerifier.verify(InvokeHTTP.java:1050)
        at 
com.squareup.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:192)
        at 
com.squareup.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:145)
        at 
com.squareup.okhttp.internal.io.RealConnection.connect(RealConnection.java:108)
        at 
com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
        at 
com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
        at 
com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
        at 
com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:283)
        at 
com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
        at com.squareup.okhttp.Call.getResponse(Call.java:286)
        at 
com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
        at 
com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
        at com.squareup.okhttp.Call.execute(Call.java:80)
        at 
org.apache.nifi.processors.standard.InvokeHTTP.onTrigger(InvokeHTTP.java:630)
        at 
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
        at 
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120)
        at 
org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)
        at 
org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
        at 
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
{code}

When that method is invoked, the existence of the {{HostnameVerifier}} should 
be checked before it is provided to the {{OverrideHostnameVerifier}}, and a 
default value of {{OkHostnameVerifier.INSTANCE}} (public static singleton) 
should be provided if none is available.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to