GitHub user bowenli86 opened a pull request:
https://github.com/apache/flink/pull/4711
[FLINK-7674][Streaming Connectors] NullPointerException in
ContinuousFileMonitoringFunction close
## What is the purpose of the change
If the ContinuousFileMonitoringFunction is closed before run is called
(because initialization fails), we get a `NullPointerException`, because
checkpointLock has not been set.
```java
synchronized (checkpointLock) {
globalModificationTime = Long.MAX_VALUE;
isRunning = false;
}
```
We need to add a null check that wraps the synchronized clause
## Brief change log
Add a null check that wraps the synchronized clause, as:
```java
if (checkpointLock != null) {
synchronized (checkpointLock) {
globalModificationTime = Long.MAX_VALUE;
isRunning = false;
}
}
```
## Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
## Does this pull request potentially affect one of the following parts:
none
## Documentation
none
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bowenli86/flink FLINK-7674
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/4711.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4711
----
commit 9a5cb031bbff33d4f9ba956656e93e31a179e309
Author: Bowen Li <[email protected]>
Date: 2017-09-24T01:24:56Z
FLINK-7674 NullPointerException in ContinuousFileMonitoringFunction close
----
---