Buggy code:
public class NSHandler implements NamespaceHandler { private static final String ATTR_INDEX = "index" ; private static final Logger _logger = LoggerFactory . getLogger ( "org.apache.aries.jpa.blueprint.aries" ) ; public static final String NS_URI_100 = "http:////aries.apache.org//xmlns//jpa//v1.0.0" ; public static final String NS_URI_110 = "http:////aries.apache.org//xmlns//jpa//v1.1.0" ; private static final String BLUEPRINT_NS = "http:////www.osgi.org//xmlns//blueprint//v1.0.0" ; private static final String TAG_UNIT = "unit" ; private static final String TAG_CONTEXT = "context" ; private static final String TAG_MAP = "map" ; private static final String ATTR_PROPERTY = "property" ; private static final String ATTR_TYPE = "type" ; private static final String ATTR_UNIT_NAME = "unitname" ; private static final String DEFAULT_UNIT_NAME = "" ; public static final String EMPTY_UNIT_NAME_FILTER = ( "(" + ( PersistenceUnitConstants . EMPTY_PERSISTENCE_UNIT_NAME ) ) + "=true)" ; private static final String ACTIVATION_EAGER = "EAGER" ; private PersistenceContextProvider manager ; private final AtomicBoolean contextsAvailable = new AtomicBoolean ( ) ; public void setManager ( PersistenceContextProvider manager ) { } public ComponentMetadata decorate ( Node node , ComponentMetadata component , ParserContext context ) { } @ SuppressWarnings ( "unchecked" ) public Set < Class > getManagedClasses ( ) { } public URL getSchemaLocation ( String namespace ) { } public Metadata parse ( Element element , ParserContext context ) { } public void contextAvailable ( ServiceReference ref ) { } public void contextUnavailable ( ServiceReference ref ) { } private BeanProperty createBeanProperty ( Element element , final String property , boolean isPersistenceUnit , ParserContext ctx ) { } private BeanArgument createArgument ( Element element , final String index , final boolean isPersistenceUnit , ParserContext ctx ) { } private Metadata createTargetMetadata ( boolean isPersistenceUnit , ParserContext ctx , String unitName ) { final MutableReferenceMetadata refMetadata = ( ( MutableReferenceMetadata ) ( ctx . createMetadata ( ReferenceMetadata . class ) ) ) ; refMetadata . setActivation ( ( NSHandler . ACTIVATION_EAGER . equalsIgnoreCase ( ctx . getDefaultActivation ( ) ) ? ReferenceMetadata . ACTIVATION_EAGER : ReferenceMetadata . ACTIVATION_LAZY ) ) ; refMetadata . setAvailability ( AVAILABILITY_MANDATORY ) ; refMetadata . setInterface ( EntityManagerFactory . class . getName ( ) ) ; StringBuilder filter = new StringBuilder ( "(&" ) ; if ( isPersistenceUnit ) filter . append ( "(!(" ) . append ( PROXY_FACTORY_EMF_ATTRIBUTE ) . append ( "=*))" ) ; else <START_BUG> filter . append ( "(" ) . append ( PROXY_FACTORY_EMF_ATTRIBUTE ) . append ( "=*)" ) ; <END_BUG> if ( ! ( "" . equals ( unitName ) ) ) filter . append ( ( ( ( ( "(" + ( PersistenceUnitConstants . OSGI_UNIT_NAME ) ) + "=" ) + unitName ) + ")" ) ) ; else filter . append ( NSHandler . EMPTY_UNIT_NAME_FILTER ) ; filter . append ( ")" ) ; refMetadata . setFilter ( filter . toString ( ) ) ; refMetadata . setTimeout ( Integer . parseInt ( ctx . getDefaultTimeout ( ) ) ) ; refMetadata . setDependsOn ( ( ( List < String > ) ( Collections . EMPTY_LIST ) ) ) ; refMetadata . setId ( ctx . generateId ( ) ) ; final Metadata target = ( isPersistenceUnit ) ? refMetadata : createInjectionBeanMetedata ( ctx , refMetadata ) ; return target ; } private Metadata createInjectionBeanMetedata ( ParserContext ctx , ReferenceMetadata factory ) { } private Bundle getBlueprintBundle ( ParserContext context ) { } private PersistenceContextType parseType ( Element element ) { } private String parseUnitName ( Element element ) { } private Map < String , Object > parseJPAProperties ( Element element , ParserContext context ) { } }

Fix:
filter . append ( "(" ) . append ( PROXY_FACTORY_EMF_ATTRIBUTE ) . append ( "=true)" ) ;