Buggy code:
public class Crawler { private Set < String > knownSites ; private List < Document > foundDocuments ; private Integer maxDocuments ; private static boolean crawlWayback = false ; private static String waybackUrl = "http:////www.webarchive.org.uk//wayback//archive//" ; public List < Document > crawlForDocuments ( WatchedTarget watchedTarget , Integer maxDocuments ) { } private void breathFirstSearch ( WatchedTarget watchedTarget , Set < Link > fringe , int linkDepth ) { if ( ( linkDepth < ( - 1 ) ) || ( ( linkDepth == ( - 1 ) ) && ( ! ( foundDocuments . isEmpty ( ) ) ) ) ) return ; Set < Link > children = new HashSet < > ( ) ; for ( Link link : fringe ) { try { if ( ( linkDepth >= 0 ) || ( urlMatchesScheme ( link . target , watchedTarget . documentUrlScheme ) ) ) { Connection connection = Jsoup . connect ( link . target ) ; connection . request ( ) . method ( GET ) ; connection . ignoreContentType ( true ) ; connection . execute ( ) ; Response response = connection . response ( ) ; String pageUrl = ( Crawler . crawlWayback ) ? urlFromWayback ( link . target ) : link . target ; if ( response . contentType ( ) . contains ( "html" ) ) { if ( linkDepth >= 0 ) { org . jsoup . nodes . Document doc = response . parse ( ) ; for ( Element element : doc . select ( "a[href]" ) ) { String waybackHrefUrl = element . absUrl ( "href" ) . replace ( "<seq2seq4repair_space>" , "%20" ) ; String hrefUrl = ( Crawler . crawlWayback ) ? urlFromWayback ( waybackHrefUrl ) : waybackHrefUrl ; if ( ( hrefUrl != null ) && ( ! ( knownSites . contains ( hrefUrl ) ) ) ) { if ( hrefUrl . endsWith ( ".pdf" ) ) { if ( urlMatchesScheme ( hrefUrl , watchedTarget . documentUrlScheme ) ) { knownSites . add ( hrefUrl ) ; Logger . debug ( ( ( ( ( "pdf<seq2seq4repair_space>found:<seq2seq4repair_space>" + hrefUrl ) + "<seq2seq4repair_space>(via<seq2seq4repair_space>" ) + ( link . target ) ) + ")" ) ) ; Document document = new Document ( ) ; document . landingPageUrl = pageUrl ; document . documentUrl = hrefUrl ; document . filename = URLDecoder . decode ( hrefUrl . substring ( ( ( hrefUrl . lastIndexOf ( '//' ) ) + 1 ) ) , "UTF-8" ) ; document . title = document . filename . substring ( 0 , document . filename . indexOf ( '.' ) ) ; document . watchedTarget = watchedTarget ; foundDocuments . add ( document ) ; if ( ( ( maxDocuments ) != null ) && ( ( foundDocuments . size ( ) ) >= ( maxDocuments ) ) ) return ; } } else if ( domainIsEqual ( pageUrl , hrefUrl ) ) { knownSites . add ( hrefUrl ) ; children . add ( new Link ( link . target , waybackHrefUrl ) ) ; } } } } } else if ( urlMatchesScheme ( pageUrl , watchedTarget . documentUrlScheme ) ) { <START_BUG> String contentDisposition = response . header ( "Content-Disposition" ) ; <END_BUG> if ( ( contentDisposition != null ) && ( contentDisposition . endsWith ( ".pdf" ) ) ) { Document document = new Document ( ) ; document . landingPageUrl = ( Crawler . crawlWayback ) ? urlFromWayback ( link . source ) : link . source ; document . documentUrl = pageUrl ; document . filename = contentDisposition . substring ( ( ( contentDisposition . lastIndexOf ( '=' ) ) + 1 ) ) ; document . title = document . filename . substring ( 0 , document . filename . indexOf ( '.' ) ) ; document . watchedTarget = watchedTarget ; foundDocuments . add ( document ) ; if ( ( ( maxDocuments ) != null ) && ( ( foundDocuments . size ( ) ) >= ( maxDocuments ) ) ) return ; Logger . debug ( ( ( ( ( "hidden<seq2seq4repair_space>pdf<seq2seq4repair_space>found:<seq2seq4repair_space>" + ( document . filename ) ) + "<seq2seq4repair_space>(url:<seq2seq4repair_space>" ) + pageUrl ) + ")" ) ) ; } } } } catch ( IOException e ) { Logger . info ( ( "Can't<seq2seq4repair_space>get<seq2seq4repair_space>content<seq2seq4repair_space>of<seq2seq4repair_space>url:<seq2seq4repair_space>" + ( link . target ) ) ) ; } } breathFirstSearch ( watchedTarget , children , ( linkDepth - 1 ) ) ; } private String waybackReplayUrl ( String url , String timestamp ) { } private String urlFromWayback ( String waybackUrl ) { } private boolean domainIsEqual ( String url , String targetUrl ) { } private boolean urlMatchesScheme ( String url , String scheme ) { } }

Fix:
String contentDisposition = response . header ( "Content-Disposition" ) . replace ( "\"" , "" ) ;