Buggy code:
svHeader daType . getId ( ) , bdaType , val , true ) ) ; initDATypes . add ( daType . getId ( ) ) ; } } dataTypesSource . appendFunctions ( "}\n" ) ; dataTypesHeader . appendDatatypes ( "\n};" ) ; if ( daTypes . hasNext ( ) ) { dataTypesHeader . appendDatatypes ( "\n" ) ; } } dataTypesHeader . appendDatatypes ( "\n\n" ) ; Iterator < TDOType > doTypes = dataTypeTemplates . getDOType ( ) . iterator ( ) ; dataTypesHeader . appendDatatypes ( "////<seq2seq4repair_space>data<seq2seq4repair_space>objects\n" ) ; while ( doTypes . hasNext ( ) ) { TDOType doType = doTypes . next ( ) ; gseEncodeSource . appendFunctionObject ( new CFunctionGSELengthCoder ( doType , CoderType . ENCODER , map ) ) ; gseEncodeSource . appendFunctionObject ( new CFunctionGSECoder ( doType , CoderType . ENCODER , map ) ) ; gseDecodeSource . appendFunctionObject ( new CFunctionGSECoder ( doType , CoderType . DECODER , map ) ) ; svEncodeSource . appendFunctionObject ( new CFunctionSVCoder ( doType , CoderType . ENCODER , map ) ) ; svDecodeSource . appendFunctionObject ( new CFunctionSVCoder ( doType , CoderType . DECODER , map ) ) ; dataTypesHeader . appendDatatypes ( ( ( "struct<seq2seq4repair_space>" + ( doType . getId ( ) ) ) + "<seq2seq4repair_space>{" ) ) ; Iterator < TDA > das = doType . getDA ( ) . iterator ( ) ; Iterator < TSDO > sdos = doType . getSDO ( ) . iterator ( ) ; while ( sdos . hasNext ( ) ) { TSDO sdo = sdos . next ( ) ; String sdoString = ( ( ( "struct<seq2seq4repair_space>" + ( sdo . getType ( ) ) ) + "<seq2seq4repair_space>" ) + ( sdo . getName ( ) ) ) + ";" ; dataTypesHeader . appendDatatypes ( ( "\n\t" + sdoString ) ) ; } dataTypesSource . appendFunctions ( ( ( ( ( ( ( "void<seq2seq4repair_space>init_" + ( doType . getId ( ) ) ) + "(struct<seq2seq4repair_space>" ) + ( doType . getId ( ) ) ) + "<seq2seq4repair_space>*" ) + ( doType . getId ( ) ) ) + ")<seq2seq4repair_space>{\n" ) ) ; while ( das . hasNext ( ) ) { TDA da = das . next ( ) ; String daString = ( ( ( map . getPrintedType ( da ) ) + "<seq2seq4repair_space>" ) + ( da . getName ( ) ) ) + ";" ; dataTypesHeader . appendDatatypes ( ( "\n\t" + daString ) ) ; Iterator < TVal > vals = da . getVal ( ) . iterator ( ) ; while ( vals . hasNext ( ) ) { TVal val = vals . next ( ) ; dataTypesSource . appendFunctions ( SCDCodeGenerator . initAbstractDataAttribute ( doType . getId ( ) , da , val , true ) ) ; initDOTypes . add ( doType . getId ( ) ) ; } } dataTypesSource . appendFunctions ( "}\n" ) ; dataTypesHeader . appendDatatypes ( "\n};" ) ; if ( doTypes . hasNext ( ) ) { dataTypesHeader . appendDatatypes ( "\n" ) ; } } Iterator < TIED > ieds = root . getSCL ( ) . getIED ( ) . iterator ( ) ; dataTypesHeader . appendDatatypes ( "\n\n////<seq2seq4repair_space>datasets" ) ; dataTypesSource . appendFunctions ( "void<seq2seq4repair_space>init_datatypes()<seq2seq4repair_space>{\n" ) ; jsonDataModelIndexSource . appendFunctions ( "void<seq2seq4repair_space>init_data_model_index()<seq2seq4repair_space>{\n" ) ; boolean svExists = false ; String databaseName = "dataModelIndex" ; JSONDatabaseManager iedJSON = new JSONDatabaseManager ( databaseName ) ; int numberOfIEDs = root . getSCL ( ) . getIED ( ) . size ( ) ; jsonDataModelIndexSource . appendInstances ( "#if<seq2seq4repair_space>JSON_INTERFACE<seq2seq4repair_space>==<seq2seq4repair_space>1\n\n" ) ; jsonDataModelIndexSource . appendInstances ( ( ( ( ( "Item<seq2seq4repair_space>" + databaseName ) + "<seq2seq4repair_space>=<seq2seq4repair_space>{\"root\",<seq2seq4repair_space>BASIC_TYPE_CONSTRUCTED,<seq2seq4repair_space>\"\",<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + numberOfIEDs ) + "};" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + databaseName ) + ".items<seq2seq4repair_space>=<seq2seq4repair_space>(Item*)<seq2seq4repair_space>calloc(" ) + numberOfIEDs ) + ",<seq2seq4repair_space>sizeof(Item));<seq2seq4repair_space>////<seq2seq4repair_space>IEDs\n" ) ) ; while ( ieds . hasNext ( ) ) { TIED ied = ieds . next ( ) ; String iedName = ied . getName ( ) ; iedHeader . appendDatatypes ( ( ( "struct<seq2seq4repair_space>" + iedName ) + "_t<seq2seq4repair_space>{\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".objectRef<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + iedName ) + "\";\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".type<seq2seq4repair_space>=<seq2seq4repair_space>BASIC_TYPE_CONSTRUCTED;\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".typeSCL<seq2seq4repair_space>=<seq2seq4repair_space>\"IED\";\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".data<seq2seq4repair_space>=<seq2seq4repair_space>&" ) + iedName ) + ";\n" ) ) ; if ( ( ied . getAccessPoint ( ) ) != null ) { Iterator < TAccessPoint > aps = ied . getAccessPoint ( ) . iterator ( ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".items<seq2seq4repair_space>=<seq2seq4repair_space>(Item*)<seq2seq4repair_space>calloc(" ) + ( ied . getAccessPoint ( ) . size ( ) ) ) + ",<seq2seq4repair_space>sizeof(Item));<seq2seq4repair_space>////<seq2seq4repair_space>APs+Servers\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".numberOfItems<seq2seq4repair_space>=<seq2seq4repair_space>" ) + ( ied . getAccessPoint ( ) . size ( ) ) ) + ";\n" ) ) ; iedJSON . addLayer ( ) ; while ( aps . hasNext ( ) ) { TAccessPoint ap = aps . next ( ) ; String apName = ap . getName ( ) ; iedHeader . appendDatatypes ( "\tstruct<seq2seq4repair_space>{\n" ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".objectRef<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + apName ) + "\";\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".type<seq2seq4repair_space>=<seq2seq4repair_space>BASIC_TYPE_CONSTRUCTED;\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".typeSCL<seq2seq4repair_space>=<seq2seq4repair_space>\"AccessPoint\";\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".data<seq2seq4repair_space>=<seq2seq4repair_space>&" ) + iedName ) + "." ) + apName ) + ";\n" ) ) ; if ( ( ( ap . getServer ( ) ) != null ) && ( ( ap . getServer ( ) . getLDevice ( ) . size ( ) ) > 0 ) ) { Iterator < TLDevice > lds = ap . getServer ( ) . getLDevice ( ) . iterator ( ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".items<seq2seq4repair_space>=<seq2seq4repair_space>(Item*)<seq2seq4repair_space>calloc(" ) + ( ap . getServer ( ) . getLDevice ( ) . size ( ) ) ) + ",<seq2seq4repair_space>sizeof(Item));<seq2seq4repair_space>////<seq2seq4repair_space>LDs\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".numberOfItems<seq2seq4repair_space>=<seq2seq4repair_space>" ) + ( ap . getServer ( ) . getLDevice ( ) . size ( ) ) ) + ";\n" ) ) ; iedJSON . addLayer ( ) ; while ( lds . hasNext ( ) ) { TLDevice ld = lds . next ( ) ; String ldName = ld . getInst ( ) ; iedHeader . appendDatatypes ( "\t\tstruct<seq2seq4repair_space>{\n" ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".objectRef<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + ldName ) + "\";\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".type<seq2seq4repair_space>=<seq2seq4repair_space>BASIC_TYPE_CONSTRUCTED;\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".typeSCL<seq2seq4repair_space>=<seq2seq4repair_space>\"LogicalDevice\";\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".data<seq2seq4repair_space>=<seq2seq4repair_space>&" ) + iedName ) + "." ) + apName ) + "." ) + ldName ) + ";\n" ) ) ; Iterator < TLN > lns = ld . getLN ( ) . iterator ( ) ; int numberOfLNs = ld . getLN ( ) . size ( ) ; if ( ( ld . getLN0 ( ) ) != null ) { numberOfLNs ++ ; } jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".items<seq2seq4repair_space>=<seq2seq4repair_space>(Item*)<seq2seq4repair_space>calloc(" ) + numberOfLNs ) + ",<seq2seq4repair_space>sizeof(Item));<seq2seq4repair_space>////<seq2seq4repair_space>LNs\n" ) ) ; jsonDataModelIndexSource . appendFunctions ( ( ( ( ( "\t" + ( iedJSON . getPath ( ) ) ) + ".numberOfItems<seq2seq4repair_space>=<seq2seq4repair_space>" ) + numberOfLNs ) + ";\n" ) ) ; iedJSON . addLayer ( ) ; if ( ( ld . getLN0 ( ) ) != null ) { TLN0 ln0 = ld . getLN0 ( ) ; String ln0Name = ln0 . getLnType ( ) . replaceAll ( "[^A-Za-z0-9]" , "_" ) ; iedHeader . appendDatatypes ( "\t\t\tstruct<seq2seq4repair_space>{\n" ) ; iedHeader . appendDatatypes ( ( ( "\t\t\t\tstruct<seq2seq4repair_space>" + ln0Name ) + "<seq2seq4repair_space>LLN0;\n" ) ) ; Iterator < TDO > ln0Dos = SCDCodeGenerator . getLNTypeDOs ( dataTypeTemplates , ln0 . getLnType ( ) ) . iterator ( ) ; <START_BUG> StringBuilder accumulatedName = new StringBuilder ( ( ( ( ( ( ( ( iedName + "." ) + apName ) + "." ) + ldName ) + "." ) + ln0Name ) + ".LLN0." ) ) ; <END_BUG>

Fix:
StringBuilder accumulatedName = new StringBuilder ( ( ( ( ( ( iedName + "." ) + apName ) + "." ) + ldName ) + ".LN0.LLN0." ) ) ;