Buggy code:
public class FairyLightsAdapterImpl extends CoreObjectBehavior implements CoreObjectSpec , FairyLightsAdapterSpec , FairyLightsStatusListener { private static Logger logger = LoggerFactory . getLogger ( FairyLightsAdapterImpl . class ) ; MongoDBConfiguration dbConfig ; boolean dbBound = false ; String host = null ; int port = - 1 ; Map < String , CoreFairyLightsSpec > instances ; JSONArray currentPattern ; LightManagement lightManager ; public static final String userType = FairyLightsAdapterSpec . class . getSimpleName ( ) ; int coreObjectStatus = 0 ; String coreObjectId ; public static final String DEFAULT_HOST = "guirlande.local" ; public static final String DEFAULT_PROTOCOL = "http:////" ; public static final String LUMIPIXEL_API_URL = "//lumipixel//api//v1.0//leds" ; public static final String URL_SEP = "//" ; public static final String KEY_COLOR = "color" ; public static final String KEY_LEDS = "leds" ; public static final String KEY_ID = "id" ; DiscoveryHeartBeat discoveryHeartBeat ; public static final long DISCOVERYPERIOD = ( 5 * 60 ) * 1000 ; Timer timer ; boolean deviceAvailable = false ; public FairyLightsAdapterImpl ( ) { } @ Override public String createFreeformLightsGroup ( String name , JSONArray selectedLights ) { } @ Override public String createContiguousLightsGroup ( String name , int startingIndex , int endingIndex ) { } @ Override public void updateLightsGroup ( String groupId , JSONArray selectedLights ) { } @ Override public void releaseLight ( int lightNumber ) { } @ Override public void removeLightsGroup ( String groupId ) { } @ Override public JSONArray getAvailableLights ( ) { } @ Override public void deviceAvailable ( String host ) { } @ Override public void deviceUnavailable ( ) { } @ Override public String getAbstractObjectId ( ) { } @ Override public CORE_TYPE getCoreType ( ) { } @ Override public JSONObject getDescription ( ) throws JSONException { } @ Override public int getObjectStatus ( ) { } @ Override public String getUserType ( ) { } String dbName = CoreObjectSpec . DBNAME_DEFAULT ; String dbCollectionNameGroups = ( CoreFairyLightsSpec . class . getSimpleName ( ) ) + "Groups" ; DBHelper dbHelperGroups = null ; private synchronized boolean dbBound ( ) { } private synchronized void restoreGroups ( ) { FairyLightsAdapterImpl . logger . trace ( "restoreGroups()" ) ; Set < JSONObject > entries = dbHelperGroups . getJSONEntries ( ) ; for ( JSONObject entry : entries ) { String id = entry . getString ( "id" ) ; if ( ( id != null ) && ( ( componentBroker . getInst ( id ) ) == null ) ) { FairyLightsAdapterImpl . logger . trace ( "restoreGroups(),<seq2seq4repair_space>no<seq2seq4repair_space>running<seq2seq4repair_space>instance<seq2seq4repair_space>with<seq2seq4repair_space>same<seq2seq4repair_space>id<seq2seq4repair_space>:<seq2seq4repair_space>{},<seq2seq4repair_space>creating<seq2seq4repair_space>one<seq2seq4repair_space>with<seq2seq4repair_space>description<seq2seq4repair_space>:<seq2seq4repair_space>{}" , id , entry ) ; <START_BUG> FairyLightsImpl group = createApamComponent ( entry . getString ( "name" ) , id ) ; <END_BUG> group . configure ( lightManager , entry ) ; instances . put ( id , group ) ; } else { FairyLightsAdapterImpl . logger . trace ( "restoreGroups(),<seq2seq4repair_space>already<seq2seq4repair_space>an<seq2seq4repair_space>instance<seq2seq4repair_space>with<seq2seq4repair_space>id<seq2seq4repair_space>:<seq2seq4repair_space>{},<seq2seq4repair_space>keeping<seq2seq4repair_space>the<seq2seq4repair_space>existing<seq2seq4repair_space>one" , entry . getString ( "id" ) ) ; } } } private synchronized void dbUnbound ( ) { } private FairyLightsImpl createApamComponent ( String groupName , String InstanceName ) { } private NotificationMsg stateChanged ( String varName , String oldValue , String newValue ) { } @ Override public void lightChanged ( JSONArray lights ) { } private static final Random idGenerator = new Random ( System . currentTimeMillis ( ) ) ; private static int counter = 0 ; public String generateInstanceID ( int size ) { } private void storeInstanceConfiguration ( JSONObject serviceDescription ) { } private void removeInstanceConfiguration ( String serviceId ) { } private void fairyLightsChangedEvent ( NotificationMsg msg ) { } }

Fix:
FairyLightsImpl group = createApamComponent ( entry . optString ( "name" , id ) , id ) ;