Skip to content

Using target property filters may cause SCR to give incorrect errors for circular component chains #43

Description

@chlarsson

The following SCR service.xml fill produce an incorrect error for a circular component chain.

A complete test example will be checked into the branch of the same name as this issue.

<?xml version="1.0" encoding="UTF-8"?>

<components>

  <component name="org.knopflerfish.bundle.componentFilter_testA"
	     immediate="true"
             xmlns="http://www.osgi.org/xmlns/scr/v1.0.0">
    <implementation
       class="org.knopflerfish.bundle.componentFilter_test.GeneralComponentImplA"/>

    <service>
      <provide
         interface="org.knopflerfish.service.componentFilter_test.GeneralComponent"/>
    </service>

    <property name="actionName" value="A" />

    <reference  name = "org.knopflerfish.service.componentFilter_test.OtherComponent"
		interface = "org.knopflerfish.service.componentFilter_test.OtherComponent"
		bind = "setOtherComponent"
		policy="static"
		cardinality="1..1"
		/>
    
  </component>

  <component name="org.knopflerfish.bundle.componentFilter_testB"
	     immediate="true"
             xmlns="http://www.osgi.org/xmlns/scr/v1.0.0">
    
    <implementation
       class="org.knopflerfish.bundle.componentFilter_test.GeneralComponentImplB"/>

    <service>
      <provide
         interface="org.knopflerfish.service.componentFilter_test.GeneralComponent"/>
    </service>

    <property name="actionName" value="B" /> 
    
    <reference  name = "org.knopflerfish.service.componentFilter_test.GeneralComponent"
		interface = "org.knopflerfish.service.componentFilter_test.GeneralComponent"
		target = "(actionName=A)"
		bind = "setGeneralComponentImplA"
		policy="static"
		cardinality="1..1"
		/>
    
  </component>

</components>

When removing the reference dependency to the OtherComponent, which is non-existing, the example above works as expected. I..e. it is only when the filtered target component is not available the problem occurs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions