Buggy code:
final class PerFieldCodecWrapper extends Codec { private final SegmentCodecs segmentCodecs ; PerFieldCodecWrapper ( SegmentCodecs segmentCodecs ) { } @ Override public FieldsConsumer fieldsConsumer ( SegmentWriteState state ) throws IOException { } private class FieldsWriter extends FieldsConsumer { private final ArrayList < FieldsConsumer > consumers = new ArrayList < FieldsConsumer > ( ) ; public FieldsWriter ( SegmentWriteState state ) throws IOException { } @ Override public TermsConsumer addField ( FieldInfo field ) throws IOException { } @ Override public void close ( ) throws IOException { Iterator < FieldsConsumer > it = consumers . iterator ( ) ; IOException err = null ; while ( it . hasNext ( ) ) { try { it . next ( ) . close ( ) ; } catch ( IOException ioe ) { if ( err == null ) { err = ioe ; } } } if ( err != null ) { throw err ; } } } private class FieldsReader extends FieldsProducer { private final Set < String > fields = new TreeSet < String > ( ) ; private final Map < String , FieldsProducer > codecs = new HashMap < String , FieldsProducer > ( ) ; public FieldsReader ( Directory dir , FieldInfos fieldInfos , SegmentInfo si , int readBufferSize , int indexDivisor ) throws IOException { } private final class FieldsIterator extends FieldsEnum { private final Iterator < String > it ; private String current ; public FieldsIterator ( ) { } @ Override public String next ( ) { } @ Override public TermsEnum terms ( ) throws IOException { } } @ Override public FieldsEnum iterator ( ) throws IOException { } @ Override public Terms terms ( String field ) throws IOException { } @ Override public void close ( ) throws IOException { Iterator < FieldsProducer > it = codecs . values ( ) . iterator ( ) ; IOException err = null ; while ( it . hasNext ( ) ) { try { it . next ( ) . close ( ) ; } catch ( IOException ioe ) { if ( err == null ) { err = ioe ; } } } if ( err != null ) { throw err ; } } @ Override public void loadTermsIndex ( int indexDivisor ) throws IOException { } } @ Override public FieldsProducer fieldsProducer ( SegmentReadState state ) throws IOException { } @ Override public void files ( Directory dir , SegmentInfo info , int codecId , Set < String > files ) throws IOException { } @ Override public void getExtensions ( Set < String > extensions ) { } @ Override public PerDocConsumer docsConsumer ( PerDocWriteState state ) throws IOException { } @ Override public PerDocValues docsProducer ( SegmentReadState state ) throws IOException { } private final class PerDocProducers extends PerDocValues { private final TreeMap < String , PerDocValues > codecs = new TreeMap < String , PerDocValues > ( ) ; public PerDocProducers ( Directory dir , FieldInfos fieldInfos , SegmentInfo si , int readBufferSize , int indexDivisor ) throws IOException { } @ Override public Collection < String > fields ( ) { } @ Override public DocValues docValues ( String field ) throws IOException { } public void close ( ) throws IOException { final Iterator < PerDocValues > it = codecs . values ( ) . iterator ( ) ; IOException err = null ; while ( it . hasNext ( ) ) { try { PerDocValues next = it . next ( ) ; if ( next != null ) { next . close ( ) ; } <START_BUG> } catch ( Exception ioe ) { <END_BUG> if ( err == null ) { err = new IOException ( ioe ) ; } } } if ( err != null ) { throw err ; } } } private final class PerDocConsumers extends PerDocConsumer { private final PerDocConsumer [ ] consumers ; private final Codec [ ] codecs ; private final PerDocWriteState state ; public PerDocConsumers ( PerDocWriteState state ) throws IOException { } public void close ( ) throws IOException { IOException err = null ; for ( int i = 0 ; i < ( consumers . length ) ; i ++ ) { try { final PerDocConsumer next = consumers [ i ] ; if ( next != null ) { next . close ( ) ; } } catch ( IOException ioe ) { if ( err == null ) { err = ioe ; } } } if ( err != null ) { throw err ; } } @ Override public DocValuesConsumer addValuesField ( FieldInfo field ) throws IOException { } } }

Fix:
} catch ( IOException ioe ) {