Buggy code:
public class AnchorModifier extends AbstractTestElement implements Serializable , PreProcessor { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; private static final long serialVersionUID = 240L ; private static final Random rand = new Random ( ) ; public AnchorModifier ( ) { } public void process ( ) { JMeterContext context = getThreadContext ( ) ; Sampler sam = context . getCurrentSampler ( ) ; SampleResult res = context . getPreviousResult ( ) ; HTTPSamplerBase sampler = null ; HTTPSampleResult result = null ; if ( ( ( res == null ) || ( ! ( sam instanceof HTTPSamplerBase ) ) ) || ( ! ( res instanceof HTTPSampleResult ) ) ) { AnchorModifier . log . info ( ( "Can't<seq2seq4repair_space>apply<seq2seq4repair_space>HTML<seq2seq4repair_space>Link<seq2seq4repair_space>Parser<seq2seq4repair_space>when<seq2seq4repair_space>the<seq2seq4repair_space>previous" + "<seq2seq4repair_space>sampler<seq2seq4repair_space>run<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>an<seq2seq4repair_space>HTTP<seq2seq4repair_space>Request." ) ) ; return ; } else { sampler = ( ( HTTPSamplerBase ) ( sam ) ) ; result = ( ( HTTPSampleResult ) ( res ) ) ; } List < HTTPSamplerBase > potentialLinks = new ArrayList < HTTPSamplerBase > ( ) ; String responseText = "" ; responseText = result . getResponseDataAsString ( ) ; Document html ; <START_BUG> int index = responseText . indexOf ( "<" ) ; <END_BUG> if ( index == ( - 1 ) ) { index = 0 ; } if ( AnchorModifier . log . isDebugEnabled ( ) ) { AnchorModifier . log . debug ( ( "Check<seq2seq4repair_space>for<seq2seq4repair_space>matches<seq2seq4repair_space>against:<seq2seq4repair_space>" + ( sampler . toString ( ) ) ) ) ; } html = ( ( Document ) ( HtmlParsingUtils . getDOM ( responseText . substring ( index ) ) ) ) ; addAnchorUrls ( html , result , sampler , potentialLinks ) ; addFormUrls ( html , result , sampler , potentialLinks ) ; addFramesetUrls ( html , result , sampler , potentialLinks ) ; if ( ( potentialLinks . size ( ) ) > 0 ) { HTTPSamplerBase url = potentialLinks . get ( AnchorModifier . rand . nextInt ( potentialLinks . size ( ) ) ) ; if ( AnchorModifier . log . isDebugEnabled ( ) ) { AnchorModifier . log . debug ( ( "Selected:<seq2seq4repair_space>" + ( url . toString ( ) ) ) ) ; } sampler . setDomain ( url . getDomain ( ) ) ; sampler . setPath ( url . getPath ( ) ) ; if ( url . getMethod ( ) . equals ( POST ) ) { PropertyIterator iter = sampler . getArguments ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Argument arg = ( ( Argument ) ( iter . next ( ) . getObjectValue ( ) ) ) ; modifyArgument ( arg , url . getArguments ( ) ) ; } } else { sampler . setArguments ( url . getArguments ( ) ) ; } sampler . setProtocol ( url . getProtocol ( ) ) ; return ; } else { AnchorModifier . log . debug ( "No<seq2seq4repair_space>matches<seq2seq4repair_space>found" ) ; } return ; } private void modifyArgument ( Argument arg , Arguments args ) { } public void addConfigElement ( ConfigElement config ) { } private void addFormUrls ( Document html , HTTPSampleResult result , HTTPSamplerBase config , List < HTTPSamplerBase > potentialLinks ) { } private void addAnchorUrls ( Document html , HTTPSampleResult result , HTTPSamplerBase config , List < HTTPSamplerBase > potentialLinks ) { } private void addFramesetUrls ( Document html , HTTPSampleResult result , HTTPSamplerBase config , List < HTTPSamplerBase > potentialLinks ) { } }

Fix:
int index = responseText . indexOf ( '<' ) ;