Buggy code:
public class BlueprintExtender implements BundleActivator , SynchronousBundleListener , BundleTrackerCustomizer { private static final String QUIESCE_PARTICIPANT_CLASS = "org.apache.aries.quiesce.participant.QuiesceParticipant" ; private static final Logger LOGGER = LoggerFactory . getLogger ( BlueprintExtender . class ) ; private BundleContext context ; private ScheduledExecutorService executors ; private final ConcurrentMap < Bundle , BlueprintContainerImpl > containers = new ConcurrentHashMap < Bundle , BlueprintContainerImpl > ( ) ; private final ConcurrentMap < Bundle , FutureTask > destroying = new ConcurrentHashMap < Bundle , FutureTask > ( ) ; private BlueprintEventDispatcher eventDispatcher ; private NamespaceHandlerRegistry handlers ; private RecursiveBundleTracker bt ; private ServiceRegistration parserServiceReg ; private ServiceRegistration quiesceParticipantReg ; private SingleServiceTracker < ProxyManager > proxyManager ; private BlueprintExtender . ExecutorServiceFinder executorServiceFinder ; private volatile boolean stopping ; public void start ( BundleContext ctx ) { } public void stop ( BundleContext context ) { } public void bundleChanged ( BundleEvent event ) { } public Object addingBundle ( Bundle bundle , BundleEvent event ) { } public void modifiedBundle ( Bundle bundle , BundleEvent event , Object object ) { <START_BUG> if ( ( ( bundle . getBundleId ( ) ) == 0 ) && ( ( bundle . getState ( ) ) == ( Bundle . STOPPING ) ) ) { <END_BUG> String val = context . getProperty ( "org.apache.aries.blueprint.preemptiveShutdown" ) ; if ( ( val == null ) || ( Boolean . parseBoolean ( val ) ) ) { stop ( context ) ; return ; } } if ( ( ( bundle . getState ( ) ) != ( Bundle . ACTIVE ) ) && ( ( bundle . getState ( ) ) != ( Bundle . STARTING ) ) ) { if ( bundle != ( this . context . getBundle ( ) ) ) { destroyContainer ( bundle ) ; } return ; } if ( stopping ) { return ; } if ( ( bundle . getState ( ) ) == ( Bundle . STARTING ) ) { String activationPolicyHeader = ( ( String ) ( bundle . getHeaders ( ) . get ( Constants . BUNDLE_ACTIVATIONPOLICY ) ) ) ; if ( ( activationPolicyHeader == null ) || ( ! ( activationPolicyHeader . startsWith ( Constants . ACTIVATION_LAZY ) ) ) ) { return ; } } createContainer ( bundle ) ; } public void removedBundle ( Bundle bundle , BundleEvent event , Object object ) { } private boolean createContainer ( Bundle bundle ) { } private void destroyContainer ( final Bundle bundle ) { } private List < Object > getBlueprintPaths ( Bundle bundle ) { } private List < Bundle > getBundlesToDestroy ( ) { } private static int getServiceUsage ( ServiceReference ref ) { } private ExecutorService getExecutorService ( Bundle bundle ) { } interface ExecutorServiceFinder { public ExecutorService find ( Bundle bundle ) { } } private boolean isCompatible ( Bundle bundle ) { } private boolean hasWildcards ( String path ) { } private String getFilePart ( URL url ) { } private String cachePath ( Bundle bundle , String filePath ) { } private URL getOverrideURLForCachePath ( String privatePath ) { } private URL getOverrideURL ( Bundle bundle , String path ) { } private URL getOverrideURL ( Bundle bundle , URL path , String basePath ) { } private void addEntry ( Bundle bundle , String path , List < Object > pathList ) { } private void addEntries ( Bundle bundle , String path , String filePattern , List < Object > pathList ) { } protected BlueprintContainerImpl getBlueprintContainerImpl ( Bundle bundle ) { } }

Fix:
if ( ( context . getBundle ( 0 ) . equals ( bundle ) ) && ( ( bundle . getState ( ) ) == ( Bundle . STOPPING ) ) ) {