Buggy code:
public final class LoggingSubsystemParser implements XMLStreamConstants , XMLElementReader < ParseResult < ExtensionContext . SubsystemConfiguration < LoggingSubsystemElement > > > { private static final LoggingSubsystemParser INSTANCE = new LoggingSubsystemParser ( ) ; public static LoggingSubsystemParser getInstance ( ) { } private static XMLStreamException unexpectedAttribute ( final XMLExtendedStreamReader reader , final int index ) { } private static XMLStreamException duplicateNamedElement ( final XMLExtendedStreamReader reader , final String name ) { } private static XMLStreamException unexpectedElement ( final XMLExtendedStreamReader reader ) { } private static XMLStreamException missingRequired ( final XMLExtendedStreamReader reader , final Set < ? > required ) { } public void readElement ( XMLExtendedStreamReader reader , ParseResult < SubsystemConfiguration < LoggingSubsystemElement > > result ) throws XMLStreamException { } void readElement ( XMLExtendedStreamReader reader , List < ? super AbstractSubsystemUpdate < LoggingSubsystemElement , ? > > updates ) throws XMLStreamException { } private static void parseLoggerElement ( final XMLExtendedStreamReader reader , List < ? super AbstractLoggingSubsystemUpdate < ? > > list ) throws XMLStreamException { String name = null ; boolean useParentHandlers = true ; <START_BUG> final EnumSet < Attribute > required = EnumSet . of ( NAME ) ; <END_BUG> final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final String value = reader . getAttributeValue ( i ) ; if ( ( reader . getAttributeNamespace ( i ) ) != null ) { throw LoggingSubsystemParser . unexpectedAttribute ( reader , i ) ; } else { final Attribute attribute = Attribute . forName ( reader . getAttributeLocalName ( i ) ) ; switch ( attribute ) { case CATEGORY : { name = value ; break ; } case USE_PARENT_HANDLERS : { useParentHandlers = Boolean . parseBoolean ( value ) ; break ; } default : throw LoggingSubsystemParser . unexpectedAttribute ( reader , i ) ; } required . remove ( attribute ) ; } } if ( ! ( required . isEmpty ( ) ) ) { throw LoggingSubsystemParser . missingRequired ( reader , required ) ; } assert name != null ; final LoggerAdd add = new LoggerAdd ( name ) ; add . setUseParentHandlers ( useParentHandlers ) ; List < String > handlers = null ; final EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; while ( ( reader . hasNext ( ) ) && ( ( reader . nextTag ( ) ) != ( XMLStreamConstants . END_ELEMENT ) ) ) { switch ( Namespace . forUri ( reader . getNamespaceURI ( ) ) ) { case LOGGING_1_0 : { final Element element = Element . forName ( reader . getLocalName ( ) ) ; if ( encountered . contains ( element ) ) { throw LoggingSubsystemParser . duplicateNamedElement ( reader , reader . getLocalName ( ) ) ; } encountered . add ( element ) ; switch ( element ) { case LEVEL : { add . setLevelName ( LoggingSubsystemParser . parseLevelElement ( reader ) ) ; break ; } case HANDLERS : { handlers = LoggingSubsystemParser . parseHandlersElement ( reader ) ; break ; } default : throw LoggingSubsystemParser . unexpectedElement ( reader ) ; } break ; } default : { throw LoggingSubsystemParser . unexpectedElement ( reader ) ; } } } list . add ( add ) ; if ( handlers != null ) { for ( String handlerName : handlers ) { list . add ( new LoggerHandlerAdd ( name , handlerName ) ) ; } } } private static String parseLevelElement ( final XMLExtendedStreamReader reader ) throws XMLStreamException { } private static void parseRootLoggerElement ( final XMLExtendedStreamReader reader , List < ? super AbstractLoggingSubsystemUpdate < ? > > list ) throws XMLStreamException { } private static AbstractFormatterSpec parseFormatterElement ( final XMLExtendedStreamReader reader ) throws XMLStreamException { } private static PatternFormatterSpec parsePatternFormatterElement ( final XMLExtendedStreamReader reader ) throws XMLStreamException { } private static void parseConsoleHandlerElement ( final XMLExtendedStreamReader reader , List < ? super AbstractLoggingSubsystemUpdate < ? > > list ) throws XMLStreamException { } private static void parseFileHandlerElement ( final XMLExtendedStreamReader reader , List < ? super AbstractLoggingSubsystemUpdate < ? > > list ) throws XMLStreamException { } private static LoggingSubsystemParser . FileSpec parseFileElement ( final XMLExtendedStreamReader reader ) throws XMLStreamException { } private static void parsePeriodicRotatingFileHandlerElement ( final XMLExtendedStreamReader reader , List < ? super AbstractLoggingSubsystemUpdate < ? > > list ) throws XMLStreamException { } private static void parseSizeRotatingHandlerElement ( final XMLExtendedStreamReader reader , List < ? super AbstractLoggingSubsystemUpdate < ? > > list ) throws XMLStreamException { } private static final Pattern SIZE_PATTERN = Pattern . compile ( "(\\d+)([kKmMgGbBtT])?" ) ; private static long parseSize ( final String value ) { } private static void parseAsyncHandlerElement ( final XMLExtendedStreamReader reader , List < ? super AbstractLoggingSubsystemUpdate < ? > > list ) throws XMLStreamException { } private static List < String > parseHandlersElement ( final XMLExtendedStreamReader reader ) throws XMLStreamException { } private static String parseRefElement ( final XMLExtendedStreamReader reader ) throws XMLStreamException { } private static final class FileSpec { private final String relativeTo ; private final String fileName ; private FileSpec ( final String relativeTo , final String fileName ) { } } }

Fix:
final EnumSet < Attribute > required = EnumSet . of ( CATEGORY ) ;