Buggy code:
public abstract class OpenNLPMWEFilter extends MWEFilter { protected final CharTermAttribute termAtt = addAttribute ( CharTermAttribute . class ) ; protected final OffsetAttribute offsetAtt = addAttribute ( OffsetAttribute . class ) ; protected final TypeAttribute typeAtt = addAttribute ( TypeAttribute . class ) ; protected boolean first = true ; protected static String SENTENCE_BREAK = "[.?!]" ; protected List < AttributeSource > tokenAttrs = new ArrayList < > ( ) ; protected Map < Integer , Integer > chunkSpans = new HashMap < > ( ) ; protected Map < Integer , String > chunkTypes = new HashMap < > ( ) ; protected int chunkStart = - 1 ; protected int chunkEnd = - 1 ; protected int tokenIdx = 0 ; public OpenNLPMWEFilter ( TokenStream input , int minTokens , int maxTokens , int minCharLength , int maxCharLength , boolean removeLeadingStopWords , boolean removeTrailingStopwords , boolean removeLeadingSymbolicTokens , boolean removeTrailingSymbolicTokens , Set < String > stopWords , boolean stopWordsIgnoreCase ) { } protected OpenNLPMWEFilter ( TokenStream input ) { } protected boolean addMWE ( ) { } private SentenceContext parseSentenceContextPayload ( PayloadAttribute attribute ) { } private void addSentenceContextPayload ( SentenceContext firstTokenSentCtx , SentenceContext lastTokenSentCtx ) { } private boolean crossBoundary ( SentenceContext firstTokenSentCtx , SentenceContext lastTokenSentCtx ) { } protected Span [ ] prune ( Span [ ] chunks , String [ ] toks ) { } protected int [ ] clean ( int start , int end , String [ ] tokens ) { } protected void resetParams ( ) { } protected String [ ] [ ] walkTokens ( ) throws IOException { List < String > wordList = new ArrayList < > ( ) ; List < String > posList = new ArrayList < > ( ) ; while ( input . incrementToken ( ) ) { CharTermAttribute textAtt = input . getAttribute ( CharTermAttribute . class ) ; OffsetAttribute offsetAtt = input . getAttribute ( OffsetAttribute . class ) ; char [ ] buffer = textAtt . buffer ( ) ; String word = new String ( buffer , 0 , ( ( offsetAtt . endOffset ( ) ) - ( offsetAtt . startOffset ( ) ) ) ) ; wordList . add ( word ) ; PayloadAttribute posAtt = input . getAttribute ( PayloadAttribute . class ) ; if ( posAtt != null ) { <START_BUG> posList . add ( posAtt . getPayload ( ) . utf8ToString ( ) ) ; <END_BUG> } AttributeSource attrs = input . cloneAttributes ( ) ; tokenAttrs . add ( attrs ) ; } if ( ( wordList . size ( ) ) != ( posList . size ( ) ) ) { StringBuilder sb = new StringBuilder ( this . getClass ( ) . getName ( ) ) ; sb . append ( "<seq2seq4repair_space>requires<seq2seq4repair_space>both<seq2seq4repair_space>token<seq2seq4repair_space>and<seq2seq4repair_space>token<seq2seq4repair_space>POS.<seq2seq4repair_space>Tokens=" ) . append ( wordList . size ( ) ) . append ( ",<seq2seq4repair_space>POS=" ) . append ( posList . size ( ) ) . append ( ",<seq2seq4repair_space>and<seq2seq4repair_space>they<seq2seq4repair_space>are<seq2seq4repair_space>inconsistent." ) . append ( "<seq2seq4repair_space>Have<seq2seq4repair_space>you<seq2seq4repair_space>enabled<seq2seq4repair_space>POS<seq2seq4repair_space>tagging<seq2seq4repair_space>in<seq2seq4repair_space>your<seq2seq4repair_space>Solr<seq2seq4repair_space>analyzer<seq2seq4repair_space>chain?" ) ; throw new IOException ( sb . toString ( ) ) ; } String [ ] words = new String [ wordList . size ( ) ] ; String [ ] pos = new String [ posList . size ( ) ] ; for ( int i = 0 ; i < ( words . length ) ; i ++ ) { words [ i ] = wordList . get ( i ) ; pos [ i ] = posList . get ( i ) ; } return new String [ ] [ ] { words , pos } ; } @ Override public final void end ( ) throws IOException { } @ Override public void reset ( ) throws IOException { } }

Fix:
posList . add ( new SentenceContext ( posAtt . getPayload ( ) . utf8ToString ( ) ) . getPosTag ( ) ) ;