Buggy code:
public class MacroInstance extends Task implements DynamicConfigurator { private MacroDef macroDef ; private Map map = new HashMap ( ) ; private Map nsElements = null ; private Map presentElements = new HashMap ( ) ; private Hashtable localProperties = new Hashtable ( ) ; public void setMacroDef ( MacroDef macroDef ) { } public void setDynamicAttribute ( String name , String value ) { } public Object createDynamicElement ( String name ) throws BuildException { } private Map getNsElements ( ) { } public static class Element implements TaskContainer { private List unknownElements = new ArrayList ( ) ; public void addTask ( Task nestedTask ) { } public List getUnknownElements ( ) { } } private static final int STATE_NORMAL = 0 ; private static final int STATE_EXPECT_BRACKET = 1 ; private static final int STATE_EXPECT_NAME = 2 ; private static final int STATE_EXPECT_EXCAPE = 3 ; private String macroSubs ( String s , Map macroMapping ) { } private UnknownElement copy ( UnknownElement ue ) { UnknownElement ret = new UnknownElement ( ue . getTag ( ) ) ; ret . setNamespace ( ue . getNamespace ( ) ) ; ret . setProject ( getProject ( ) ) ; ret . setQName ( ue . getQName ( ) ) ; ret . setTaskName ( ue . getTaskName ( ) ) ; ret . setLocation ( ue . getLocation ( ) ) ; if ( ( getOwningTarget ( ) ) == null ) { Target t = new Target ( ) ; t . setProject ( getProject ( ) ) ; ret . setOwningTarget ( t ) ; } else { ret . setOwningTarget ( getOwningTarget ( ) ) ; } RuntimeConfigurable rc = new RuntimeConfigurable ( ret , ue . getTaskName ( ) ) ; rc . setPolyType ( ue . getWrapper ( ) . getPolyType ( ) ) ; Map map = ue . getWrapper ( ) . getAttributeMap ( ) ; for ( Iterator i = map . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( ( Map . Entry ) ( i . next ( ) ) ) ; rc . setAttribute ( ( ( String ) ( entry . getKey ( ) ) ) , macroSubs ( ( ( String ) ( entry . getValue ( ) ) ) , localProperties ) ) ; } rc . addText ( macroSubs ( ue . getWrapper ( ) . getText ( ) . toString ( ) , localProperties ) ) ; Enumeration e = ue . getWrapper ( ) . getChildren ( ) ; while ( e . hasMoreElements ( ) ) { RuntimeConfigurable r = ( ( RuntimeConfigurable ) ( e . nextElement ( ) ) ) ; UnknownElement unknownElement = ( ( UnknownElement ) ( r . getProxy ( ) ) ) ; <START_BUG> String tag = unknownElement . getTaskType ( ) ; <END_BUG> MacroDef . TemplateElement templateElement = ( ( MacroDef . TemplateElement ) ( getNsElements ( ) . get ( tag ) ) ) ; if ( templateElement == null ) { UnknownElement child = copy ( unknownElement ) ; rc . addChild ( child . getWrapper ( ) ) ; ret . addChild ( child ) ; } else { MacroInstance . Element element = ( ( MacroInstance . Element ) ( presentElements . get ( tag ) ) ) ; if ( element == null ) { if ( ! ( templateElement . isOptional ( ) ) ) { throw new BuildException ( ( ( "Required<seq2seq4repair_space>nested<seq2seq4repair_space>element<seq2seq4repair_space>" + ( templateElement . getName ( ) ) ) + "<seq2seq4repair_space>missing" ) ) ; } continue ; } for ( Iterator i = element . getUnknownElements ( ) . iterator ( ) ; i . hasNext ( ) ; ) { UnknownElement child = ( ( UnknownElement ) ( i . next ( ) ) ) ; rc . addChild ( child . getWrapper ( ) ) ; ret . addChild ( child ) ; } } } return ret ; } public void execute ( ) { } }

Fix:
String tag = unknownElement . getTaskType ( ) . toLowerCase ( Locale . US ) ;