Buggy code:
public static boolean getBooleanAttributeValue ( XbaseElement el , String attrName ) { } public static XfunctionDefinition findFunctionDefinition ( XcodeProgram xcodeml , XfunctionCall fctCall ) { } public static List < XarrayRef > getAllArrayReferences ( Xbody parent ) { } public static List < XrealConstant > getRealConstants ( XbaseElement parent ) { } public static void insertFctCallIntoLoop ( XdoStatement loop , XfunctionCall call ) { } public static XfunctionDefinition findParentFctDef ( XbaseElement child ) { } public static XdoStatement findDoStatement ( XfunctionDefinition fctDef , boolean any ) { } public static Xvar findVar ( XbaseElement parent , boolean any ) { } public static XvarRef findVarRef ( XbaseElement parent , boolean any ) { } public static XindexRange findIndexRange ( XbaseElement parent , boolean any ) { } public static XarrayIndex findArrayIndex ( XbaseElement parent , boolean any ) { } public static Xname findName ( XbaseElement parent , boolean any ) { } public static Xvalue findValue ( XbaseElement parent , boolean any ) { } public static XexprModel findExprModel ( XbaseElement parent , boolean any ) { } public static XbaseElement findVarRefInnerElement ( XbaseElement parent ) { } public static Xconstant findConstant ( XbaseElement parent , boolean any ) { } public static XintConstant findIntConstant ( XbaseElement parent , boolean any ) { } public static XrealConstant findRealConstant ( XbaseElement parent , boolean any ) { } public static XcomplexConstant findComplexConstant ( XbaseElement parent , boolean any ) { } public static XcharacterConstant findCharacterConstant ( XbaseElement parent , boolean any ) { } public static XlogicalConstant findLogicalConstant ( XbaseElement parent , boolean any ) { } public static Xcondition findCondition ( XbaseElement parent , boolean any ) { } public static Xthen findThen ( XbaseElement parent , boolean any ) { } public static Xelse findElse ( XbaseElement parent , boolean any ) { } public static XargumentsTable findArgumentsTable ( XbaseElement parent , boolean any ) { } public static XlowerBound findLowerBound ( XbaseElement parent , boolean any ) { } public static XupperBound findUpperBound ( XbaseElement parent , boolean any ) { } public static Xstep findStep ( XbaseElement parent , boolean any ) { } public static Xbody findBody ( XbaseElement parent , boolean any ) { } public static XdoStatement findDoStatement ( XbaseElement parent , boolean any ) { } public static XdoStatement findNextDoStatement ( XbaseElement from ) { } public static XsymbolTable findSymbols ( XbaseElement parent , boolean any ) { } public static XdeclTable findDeclarations ( XbaseElement parent , boolean any ) { } public static XtypeTable findTypeTable ( XcodeProgram parent , boolean any ) { } public static XglobalSymbolTable findGlobalSymbols ( XcodeProgram parent , boolean any ) { } public static XglobalDeclTable findGlobalDeclarations ( XcodeProgram parent , boolean any ) { } public static Xparams findParams ( XbaseElement parent , boolean any ) { } public static int findNumberOfRange ( XbaseElement parent ) { } public static List < Xindex > findIndexes ( XbaseElement parent ) { } public static List < Xname > findAllNames ( XbaseElement parent ) { } public static Xlength findLen ( XbaseElement parent , boolean any ) { } public static Xkind findKind ( XbaseElement parent , boolean any ) { } public static XfunctionCall findFctCall ( XbaseElement parent , boolean any ) { } public static XfunctionCall findFctCall ( XexprStatement exprStmt ) { } public static XexprStatement findNextExprStatement ( XbaseElement from ) { } public static XdoStatement findDirectNextDoStmt ( XbaseElement from ) { } public static XifStatement findDirectNextIfStmt ( XbaseElement from ) { } public static void deleteBetween ( Xpragma start , Xpragma end ) { } public static List < Xpragma > findAllPragmas ( XcodeProgram xcodeml ) { } public static boolean hasSameParentBlock ( XbaseElement e1 , XbaseElement e2 ) { } public static void appendBody ( Xbody originalBody , Xbody extraBody ) throws IllegalTransformationException { } public static void extractBody ( XdoStatement loop ) { } public static void delete ( Element element ) { } public static boolean writeXcodeML ( XcodeProgram xcodeml , String outputFile , int indent ) { } public static void cleanEmptyTextNodes ( Node parentNode ) { } public static boolean validateStringAttribute ( Document doc , String attrValue , String xpathQuery ) throws Exception { } public static void insertBefore ( XbaseElement ref , XbaseElement insert ) { } public static void insertAfter ( XbaseElement refElement , XbaseElement element ) { } private static void removeEmptyTextNodes ( Node parentNode ) { } private static boolean checkNodeTypes ( Node childNode ) { } private static void insertAfter ( Node refNode , Node newNode ) { } private static < T extends XbaseElement > T findXelement ( XbaseElement parent , boolean any , Class < T > xElementClass ) { } private static < T extends XbaseElement > T findNextElementOfType ( XbaseElement from , Class < T > xElementClass ) { } private static < T extends XbaseElement > T findDirectNextElement ( XbaseElement from , Class < T > xElementClass ) { } private static Element findElement ( XbaseElement parent , String elementName , boolean any ) { } private static Element findElement ( Element parent , String elementName , boolean any ) { } private static Element findFirstElement ( XbaseElement parent , String elementName ) { } private static Element findFirstElement ( Element parent , String elementName ) { } private static Element findFirstChildElement ( Element parent , String elementName ) { } private static Element getFirstChildElement ( Element parent ) { } public static < T extends XbaseElement > T createEmpty ( Class < T > xElementClass , XcodeProgram xcodeml ) { String elementName = XelementName . getElementNameFromClass ( xElementClass ) ; <START_BUG> if ( elementName == null ) { <END_BUG> Element element = xcodeml . getDocument ( ) . createElement ( elementName ) ; try { return xElementClass . getDeclaredConstructor ( Element . class ) . newInstance ( element ) ; } catch ( Exception ex ) { return null ; } } return null ; } }

Fix:
if ( elementName != null ) {