streamthoughts/azkarra-streams

ComponentNameGenerator fails to generate component name for inner class

fhussonnois opened this issue · 0 comments

Describe the bug

The DefaultComponentFactory throw an exception when a component singleton created from an inner class is registered.

The factory fail to compute a component name.

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
	at java.base/java.lang.String.charAt(String.java:693)
	at io.streamthoughts.azkarra.api.components.ComponentNameGenerator$1.generate(ComponentNameGenerator.java:36)
	at io.streamthoughts.azkarra.runtime.components.DefaultComponentDescriptorFactory.make(DefaultComponentDescriptorFactory.java:96)
	at io.streamthoughts.azkarra.runtime.components.DefaultComponentFactory.registerSingleton(DefaultComponentFactory.java:453)
	at io.streamthoughts.azkarra.api.components.ComponentRegistry.registerSingleton(ComponentRegistry.java:99)
	at io.streamthoughts.azkarra.runtime.components.DefaultComponentFactory.registerSingleton(DefaultComponentFactory.java:488)

To Reproduce
Steps to reproduce the behavior:

  1. Manually register a anonymous component to the DefaultAzkarraContext
    var context = DefaultAzkarraContext.create();
    context.registerSingleton(new StreamsLifecycleInterceptor() {
      @Override
      public void onStart(StreamsLifecycleContext context, StreamsLifecycleChain chain) {
        System.out.println("Starting!");
      }
    });