[ https://issues.apache.org/jira/browse/KAFKA-4827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16095792#comment-16095792 ]
Ewen Cheslack-Postava commented on KAFKA-4827: ---------------------------------------------- [~sliebau] Yeah, naming is, unfortunately, difficult. Kafka topics take a pretty extremely restrictive perspective on this, see the regex that topic names are restricted to: https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/internals/Topic.java#L29. I'd prefer not to get quite so extreme with Connect names if possible, but it's clear some things need to be blacklisted. But it's a tricky decision. Being strict in what we allow ensures we can validate easily and we're relatively safe by default, but it is also very limiting (e.g., definitely no characters outside of ASCII). On the other hand, trying to be liberal means we'll undoubtedly have a string of patches to handle cases we didn't think of up front... > Kafka connect: error with special characters in connector name > -------------------------------------------------------------- > > Key: KAFKA-4827 > URL: https://issues.apache.org/jira/browse/KAFKA-4827 > Project: Kafka > Issue Type: Bug > Components: KafkaConnect > Affects Versions: 0.10.1.0 > Reporter: Aymeric Bouvet > Priority: Minor > > When creating a connector, if the connector name (and possibly other > properties) end with a carriage return, kafka-connect will create the config > but report error > {code} > cat << EOF > file-connector.json > { > "name": "file-connector\r", > "config": { > "topic": "kafka-connect-logs\r", > "tasks.max": "1", > "file": "/var/log/ansible-confluent/connect.log", > "connector.class": > "org.apache.kafka.connect.file.FileStreamSourceConnector" > } > } > EOF > curl -X POST -H "Content-Type: application/json" -H "Accept: > application/json" -d @file-connector.json localhost:8083/connectors > {code} > returns an error 500 <Request Failed> and log the following > {code} > [2017-03-01 18:25:23,895] WARN (org.eclipse.jetty.servlet.ServletHandler) > javax.servlet.ServletException: java.lang.IllegalArgumentException: Illegal > character in path at index 27: /connectors/file-connector4 > at > org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489) > at > org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) > at > org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) > at > org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) > at > org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) > at > org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) > 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:311) > at > org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) > at > org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) > 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.IllegalArgumentException: Illegal character in path at > index 27: /connectors/file-connector4 > at java.net.URI.create(URI.java:852) > at > org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource.createConnector(ConnectorsResource.java:100) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) > at > org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) > at > org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) > at > org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) > at > org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) > at > org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) > at > org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) > at > org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) > at > org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) > at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) > at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) > at org.glassfish.jersey.internal.Errors.process(Errors.java:315) > at org.glassfish.jersey.internal.Errors.process(Errors.java:297) > at org.glassfish.jersey.internal.Errors.process(Errors.java:267) > at > org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) > at > org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) > at > org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) > at > org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) > ... 23 more > Caused by: java.net.URISyntaxException: Illegal character in path at index > 27: /connectors/file-connector4 > at java.net.URI$Parser.fail(URI.java:2848) > at java.net.URI$Parser.checkChars(URI.java:3021) > at java.net.URI$Parser.parseHierarchical(URI.java:3105) > at java.net.URI$Parser.parse(URI.java:3063) > at java.net.URI.<init>(URI.java:588) > at java.net.URI.create(URI.java:850) > ... 46 more > {code} > Connector is accessible at connectors/file-connector%0D and task is correctly > running, but there may be some problem underneath -- This message was sent by Atlassian JIRA (v6.4.14#64029)