Buggy code:
public void setMode ( int mode ) { } public void setMode ( int mode , boolean on ) { } @ Override protected File getSourceFile ( Object obj ) { } protected boolean isMetaDataMode ( ) { } protected boolean isQueryMode ( ) { } protected boolean isMappingMode ( ) { } protected boolean isMappingMode ( ClassMetaData meta ) { } protected boolean isMappingMode ( ValueMetaData vmd ) { } public void addMetaData ( ClassMetaData meta ) { } public void addSequenceMetaData ( SequenceMetaData meta ) { } public void addQueryMetaData ( QueryMetaData meta ) { } public void addAll ( MetaDataRepository repos ) { } public boolean removeMetaData ( ClassMetaData meta ) { } public boolean removeSequenceMetaData ( SequenceMetaData meta ) { } public boolean removeQueryMetaData ( QueryMetaData meta ) { } public boolean removeAll ( MetaDataRepository repos ) { } public void clear ( ) { } @ Override protected Collection getObjects ( ) { } protected void addSystemMappingElements ( Collection toSerialize ) { } private void serializationSort ( List objs ) { } protected XMLPersistenceMetaDataSerializer . SerializationComparator newSerializationComparator ( ) { } private void addSequenceMetaDatas ( Collection all ) { } private void addQueryMetaDatas ( Collection all ) { } @ Override protected void serialize ( Collection objects ) throws SAXException { } @ Override protected String getPackage ( Object obj ) { } protected int type ( Object o ) { } private void serializeNamespaceAttributes ( ) throws SAXException { } protected void serializeSystemMappingElement ( Object obj ) throws SAXException { } private void serializeQuery ( QueryMetaData meta ) throws SAXException { } private void serializeQueryHints ( QueryMetaData meta ) throws SAXException { } protected void serializeSequence ( SequenceMetaData meta ) throws SAXException { } protected void serializeClass ( ClassMetaData meta , boolean access ) throws SAXException { } private static String getEntityElementName ( ClassMetaData meta ) { } private static MetaDataTag getEntityTag ( ClassMetaData meta ) { } private void addClassAttributes ( ClassMetaData meta , boolean access ) { } protected void addClassMappingAttributes ( ClassMetaData mapping ) throws SAXException { } private void serializeIdClass ( ClassMetaData meta ) throws SAXException { } protected void serializeClassMappingContent ( ClassMetaData mapping ) throws SAXException { } protected void serializeInheritanceContent ( ClassMetaData mapping ) throws SAXException { } protected void serializeQueryMappings ( ClassMetaData meta ) throws SAXException { } private void serializeField ( FieldMetaData fmd , FieldMetaData orig ) throws SAXException { } protected void addFieldMappingAttributes ( FieldMetaData fmd , FieldMetaData orig ) throws SAXException { } protected boolean serializeAttributeOverride ( FieldMetaData fmd , FieldMetaData orig ) { } private void serializeAttributeOverrideContent ( FieldMetaData fmd , FieldMetaData orig ) throws SAXException { } protected void serializeAttributeOverrideMappingContent ( FieldMetaData fmd , FieldMetaData orig ) throws SAXException { } private void serializeCascades ( ValueMetaData vmd ) throws SAXException { Collection < String > cascades = null ; if ( ( vmd . getCascadePersist ( ) ) == ( ValueMetaData . CASCADE_IMMEDIATE ) ) { if ( cascades == null ) cascades = new ArrayList < String > ( ) ; cascades . add ( "cascade-persist" ) ; } if ( ( vmd . getCascadeAttach ( ) ) == ( ValueMetaData . CASCADE_IMMEDIATE ) ) { if ( cascades == null ) cascades = new ArrayList < String > ( ) ; cascades . add ( "cascade-merge" ) ; } if ( ( vmd . getCascadeDelete ( ) ) == ( ValueMetaData . CASCADE_IMMEDIATE ) ) { if ( cascades == null ) cascades = new ArrayList < String > ( ) ; cascades . add ( "cascade-remove" ) ; } if ( ( vmd . getCascadeRefresh ( ) ) == ( ValueMetaData . CASCADE_IMMEDIATE ) ) { if ( cascades == null ) cascades = new ArrayList < String > ( ) ; cascades . add ( "cascade-refresh" ) ; } if ( ( cascades != null ) && ( ( cascades . size ( ) ) == 4 ) ) { cascades . clear ( ) ; cascades . add ( "cascade-all" ) ; } if ( cascades != null ) { startElement ( "cascade" ) ; for ( String cascade : cascades ) { startElement ( cascade ) ; <START_BUG> endElement ( "cascade" ) ; <END_BUG> } endElement ( "cascade" ) ; } } protected PersistenceStrategy getStrategy ( FieldMetaData fmd ) { } private void addBasicAttributes ( FieldMetaData fmd ) throws SAXException { } private void addManyToOneAttributes ( FieldMetaData fmd ) throws SAXException { } private void addOneToOneAttributes ( FieldMetaData fmd ) throws SAXException { } private void addOneToManyAttributes ( FieldMetaData fmd ) throws SAXException { } private void addManyToManyAttributes ( FieldMetaData fmd ) throws SAXException { } protected void serializeFieldMappingContent ( FieldMetaData fmd , PersistenceStrategy strategy ) throws SAXException { } protected void addStrategyMappingAttributes ( FieldMetaData fmd ) throws SAXException { } private static class ClassSeqs implements Comparable < XMLPersistenceMetaDataSerializer . ClassSeqs > , Comparator < SequenceMetaData > , SourceTracker { private final SequenceMetaData [ ] _seqs ; public ClassSeqs ( List < SequenceMetaData > seqs ) { } public SequenceMetaData [ ] getSequences ( ) { } public int compare ( SequenceMetaData o1 , SequenceMetaData o2 ) { } public File getSourceFile ( ) { } public Object getSourceScope ( ) { } public int getSourceType ( ) { } public String getResourceName ( ) { } public int compareTo ( XMLPersistenceMetaDataSerializer . ClassSeqs other ) { } } private static class ClassQueries implements Comparable < XMLPersistenceMetaDataSerializer . ClassQueries > , Comparator < QueryMetaData > , SourceTracker { private final QueryMetaData [ ] _queries ; public ClassQueries ( List < QueryMetaData > queries ) { } public QueryMetaData [ ] getQueries ( ) { } public int compare ( QueryMetaData o1 , QueryMetaData o2 ) { } public File getSourceFile ( ) { } public Object getSourceScope ( ) { } public int getSourceType ( ) { } public String getResourceName ( ) { } public int compareTo ( XMLPersistenceMetaDataSerializer . ClassQueries other ) { }

Fix:
endElement ( cascade ) ;