GitHub user mfenniak opened a pull request:

    https://github.com/apache/kafka/pull/2087

    MINOR: Fix NPE when Connect offset contains non-primitive type

    When storing a non-primitive type in a Connect offset, the following 
NullPointerException will occur:
    
    ```
    07:18:23.702 [pool-3-thread-1] ERROR o.a.k.c.storage.OffsetStorageWriter - 
CRITICAL: Failed to serialize offset data, making it impossible to commit 
offsets under namespace tenant-db-bootstrap-source. This likely won't recover 
unless the unserializable partition or offset information is overwritten.
    07:18:23.702 [pool-3-thread-1] ERROR o.a.k.c.storage.OffsetStorageWriter - 
Cause of serialization failure:
    java.lang.NullPointerException: null
        at 
org.apache.kafka.connect.storage.OffsetUtils.validateFormat(OffsetUtils.java:51)
        at 
org.apache.kafka.connect.storage.OffsetStorageWriter.doFlush(OffsetStorageWriter.java:143)
        at 
org.apache.kafka.connect.runtime.WorkerSourceTask.commitOffsets(WorkerSourceTask.java:319)
    ... snip ...
    ```
    
    The attached patch fixes the specific case where OffsetUtils.validateFormat 
is attempting to provide a useful error message, but fails to because the 
schemaType method could return null.
    
    This contribution is my original work and I license the work to the project 
under the project's open source license.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mfenniak/kafka 
fix-npr-with-clearer-error-message

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2087.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 #2087
    
----
commit 9f4fbefde16d01a6a3ff331be580ee3764675ede
Author: Mathieu Fenniak <mathieu.fenn...@replicon.com>
Date:   2016-11-01T13:31:58Z

    Fix exception thrown when non-primitive type is stored in offset

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to