[ https://issues.apache.org/jira/browse/CAMEL-7971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Willem Jiang reassigned CAMEL-7971: ----------------------------------- Assignee: Willem Jiang > Setting bean reference in <restConfiguration> fails with > IllegalFormatWidthException > ------------------------------------------------------------------------------------ > > Key: CAMEL-7971 > URL: https://issues.apache.org/jira/browse/CAMEL-7971 > Project: Camel > Issue Type: Bug > Components: camel-core, camel-netty4-http > Affects Versions: 2.14.0 > Reporter: Ralf Steppacher > Assignee: Willem Jiang > > I am trying to set a custom HTTP binding on the netty4-http endpoint created > for the REST-DSL routes. The '#' in the bean ref, URL encoded as %23, makes > the endpoint generation fail because it is interpreted by the string > formatter. > {code:xml} > <restConfiguration component="netty4-http" scheme="http" host="{{rest.host}}" > port="{{rest.port}}" bindingMode="json"> > <endpointProperty key="nettyHttpBinding" > value="#noStackTraceHTTPBinding"/> > </restConfiguration> > <rest path="/base" produces="application/json"> > <get uri="/path"> > <to uri="direct:myroute" /> > </get> > </rest> > {code} > This configuration results in the following template string > (NettyHttpComponent.java line 279): > {{netty4-http:%s://%s:%s/%s?httpMethodRestrict=%s?nettyHttpBinding=%23noStackTraceHTTPBinding}} > The main problem is the hash mark encoded as "%23" and interpreted by the > string formatter. Also, the second '?' in the URL probably should be a '&'. > Full stacktrace: > {code} > java.util.IllegalFormatWidthException: 23 > at > java.util.Formatter$FormatSpecifier.checkText(Formatter.java:2996)[:1.7.0_60] > at > java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2688)[:1.7.0_60] > at java.util.Formatter.parse(Formatter.java:2528)[:1.7.0_60] > at java.util.Formatter.format(Formatter.java:2469)[:1.7.0_60] > at java.util.Formatter.format(Formatter.java:2423)[:1.7.0_60] > at java.lang.String.format(String.java:2790)[:1.7.0_60] > at > org.apache.camel.component.netty4.http.NettyHttpComponent.createConsumer(NettyHttpComponent.java:279) > at > org.apache.camel.component.rest.RestEndpoint.createConsumer(RestEndpoint.java:167) > at > org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:65) > at > org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:80) > at org.apache.camel.impl.RouteService.warmUp(RouteService.java:134) > at > org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:2379) > at > org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:2309) > at > org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:2091) > at > org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1951) > at > org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1777) > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at > org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1745) > at > org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:177) > at > org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:209) > at > org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:147) > at > org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932) > at > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793) > at > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543) > at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4419) > at org.apache.felix.framework.Felix.registerService(Felix.java:3423) > at > org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346) > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:452) > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:387) > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269) > at > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276) > at > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:245) > at > org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:235) > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) > at > org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103) > at > org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695) > at > org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483) > at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403) > at org.apache.felix.framework.Felix.startBundle(Felix.java:2092) > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955) > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942) > at > org.apache.karaf.features.internal.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:477) > at > org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:435) > at > org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:375) > at > org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:364) > at Proxy486edb88_52c2_40bf_8539_fb7a444aafe1.installFeature(Unknown > Source) > at > org.apache.karaf.features.command.InstallFeatureCommand.doExecute(InstallFeatureCommand.java:67) > at > org.apache.karaf.features.command.FeaturesCommandSupport.doExecute(FeaturesCommandSupport.java:38) > at > org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33)[25:org.apache.karaf.shell.console:3.0.2] > at Proxy4496acc0_5450_4cc1_881a_14668e65e5a7.execute(Unknown Source)[:] > at Proxy4496acc0_5450_4cc1_881a_14668e65e5a7.execute(Unknown Source)[:] > at > org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[25:org.apache.karaf.shell.console:3.0.2] > at > org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:92) > at > org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:203) > at > org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1$1.run(LocalConsoleManager.java:115) > at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_60] > at > org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:57)[26:org.apache.karaf.jaas.modules:3.0.2] > at > org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1.run(LocalConsoleManager.java:108)[25:org.apache.karaf.shell.console:3.0.2] > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)