Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-3690

Avoid passing null to UnmodifiableMap

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0.0
    • Fix Version/s: 0.10.0.0
    • Component/s: KafkaConnect
    • Labels:
      None

      Description

      For some version of JDK, if we pass null to UnModifiableMap's constructor, an NullPointerException will be thrown.

      This is produced by
      curl -X POST -H "Content-Type: application/json" --data '{"name": "local-conscq!-source", "config": {"connector.class":"org.apache.kafka.connect.file.FileStreamSourceConnector", "tasks.max":"1", "topic":"connect-test" }}' http://localhost:8083/connectors

      2016-05-09 12:36:03,974] INFO Starting connectors and tasks using config offset -1 (org.apache.kafka.connect.runtime.distributed.DistributedHerder:639)
      [2016-05-09 12:36:03,974] INFO Finished starting connectors and tasks (org.apache.kafka.connect.runtime.distributed.DistributedHerder:659)
      [2016-05-09 12:36:42,691] WARN (org.eclipse.jetty.servlet.ServletHandler:620)
      javax.servlet.ServletException: java.lang.NullPointerException
      at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:487)
      at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.Server.handle(Server.java:499)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NullPointerException
      at java.util.Collections$UnmodifiableMap.<init>(Collections.java:1446)
      at java.util.Collections.unmodifiableMap(Collections.java:1433)
      at org.apache.kafka.connect.data.SchemaBuilder.parameters(SchemaBuilder.java:184)
      at org.apache.kafka.connect.json.JsonConverter.asJsonSchema(JsonConverter.java:415)
      at org.apache.kafka.connect.json.JsonConverter.asJsonSchema(JsonConverter.java:398)
      at org.apache.kafka.connect.json.JsonConverter.convertToJsonWithEnvelope(JsonConverter.java:551)
      at org.apache.kafka.connect.json.JsonConverter.fromConnectData(JsonConverter.java:305)
      at org.apache.kafka.connect.storage.KafkaConfigStorage.putConnectorConfig(KafkaConfigStorage.java:282)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder$4.call(DistributedHerder.java:428)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder$4.call(DistributedHerder.java:407)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder.tick(DistributedHerder.java:210)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder.run(DistributedHerder.java:159)
      ... 1 more
      [2016-05-09 12:36:42,694] INFO 127.0.0.1 - - [09/May/2016:19:36:42 +0000] "POST /connectors HTTP/1.1" 500 294 133 (org.apache.kafka.connect.runtime.rest.RestServer:60)
      [2016-05-09 12:36:42,694] WARN /connectors (org.eclipse.jetty.server.HttpChannel:395)
      javax.servlet.ServletException: javax.servlet.ServletException: java.lang.NullPointerException
      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:130)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.Server.handle(Server.java:499)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: javax.servlet.ServletException: java.lang.NullPointerException
      at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:487)
      at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
      ... 10 more
      Caused by: java.lang.NullPointerException
      at java.util.Collections$UnmodifiableMap.<init>(Collections.java:1446)
      at java.util.Collections.unmodifiableMap(Collections.java:1433)
      at org.apache.kafka.connect.data.SchemaBuilder.parameters(SchemaBuilder.java:184)
      at org.apache.kafka.connect.json.JsonConverter.asJsonSchema(JsonConverter.java:415)
      at org.apache.kafka.connect.json.JsonConverter.asJsonSchema(JsonConverter.java:398)
      at org.apache.kafka.connect.json.JsonConverter.convertToJsonWithEnvelope(JsonConverter.java:551)
      at org.apache.kafka.connect.json.JsonConverter.fromConnectData(JsonConverter.java:305)
      at org.apache.kafka.connect.storage.KafkaConfigStorage.putConnectorConfig(KafkaConfigStorage.java:282)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder$4.call(DistributedHerder.java:428)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder$4.call(DistributedHerder.java:407)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder.tick(DistributedHerder.java:210)
      at org.apache.kafka.connect.runtime.distributed.DistributedHerder.run(DistributedHerder.java:159)
      ... 1 more
      [2016-05-09 12:36:42,696] WARN Could not send response error 500: javax.servlet.ServletException: javax.servlet.ServletException: java.lang.NullPointerException (org.eclipse.jetty.server.HttpChannel:481)

        Attachments

          Activity

            People

            • Assignee:
              liquanpei Liquan Pei
              Reporter:
              liquanpei Liquan Pei
              Reviewer:
              Ewen Cheslack-Postava
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified