Buggy code:
class HtmlParserHTMLParser extends HTMLParser { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; private static final String ATT_HREF = "href" ; private static final String STYLESHEET = "stylesheet" ; private static final String ATT_REL = "rel" ; private static final String ATT_SRC = "src" ; private static final String ATT_IS_IMAGE = "image" ; private static final String ATT_TYPE = "type" ; protected HtmlParserHTMLParser ( ) { } protected boolean isReusable ( ) { } public Iterator getEmbeddedResourceURLs ( byte [ ] html , URL baseUrl , URLCollection urls ) throws HTMLParseException { Parser htmlParser = null ; try { String contents = new String ( html ) ; StringReader reader = new StringReader ( contents ) ; NodeReader nreader = new NodeReader ( reader , contents . length ( ) ) ; htmlParser = new Parser ( nreader , new DefaultParserFeedback ( ) ) ; HtmlParserHTMLParser . addTagListeners ( htmlParser ) ; } catch ( Exception e ) { throw new HTMLParseException ( e ) ; } try { for ( NodeIterator e = htmlParser . elements ( ) ; e . hasMoreNodes ( ) ; ) { Node node = e . nextNode ( ) ; String binUrlStr = null ; if ( node instanceof BodyTag ) { BodyTag body = ( ( BodyTag ) ( node ) ) ; binUrlStr = body . getAttribute ( "background" ) ; e = body . elements ( ) ; } else if ( node instanceof BaseHrefTag ) { BaseHrefTag baseHref = ( ( BaseHrefTag ) ( node ) ) ; String baseref = baseHref . getBaseUrl ( ) ; try { if ( ! ( baseref . equals ( "" ) ) ) { <START_BUG> baseUrl = new URL ( baseUrl , ( ( baseHref . getBaseUrl ( ) ) + "//" ) ) ; <END_BUG> } } catch ( MalformedURLException e1 ) { throw new HTMLParseException ( e1 ) ; } } else if ( node instanceof ImageTag ) { ImageTag image = ( ( ImageTag ) ( node ) ) ; binUrlStr = image . getImageURL ( ) ; } else if ( node instanceof AppletTag ) { AppletTag applet = ( ( AppletTag ) ( node ) ) ; binUrlStr = applet . getAppletClass ( ) ; } else if ( node instanceof InputTag ) { InputTag input = ( ( InputTag ) ( node ) ) ; String strType = input . getAttribute ( HtmlParserHTMLParser . ATT_TYPE ) ; if ( ( strType != null ) && ( strType . equalsIgnoreCase ( HtmlParserHTMLParser . ATT_IS_IMAGE ) ) ) { binUrlStr = input . getAttribute ( HtmlParserHTMLParser . ATT_SRC ) ; } } else if ( node instanceof LinkTag ) { LinkTag link = ( ( LinkTag ) ( node ) ) ; if ( ( link . getChild ( 0 ) ) instanceof ImageTag ) { ImageTag img = ( ( ImageTag ) ( link . getChild ( 0 ) ) ) ; binUrlStr = img . getImageURL ( ) ; } } else if ( node instanceof ScriptTag ) { ScriptTag script = ( ( ScriptTag ) ( node ) ) ; binUrlStr = script . getAttribute ( HtmlParserHTMLParser . ATT_SRC ) ; } else if ( node instanceof FrameTag ) { FrameTag tag = ( ( FrameTag ) ( node ) ) ; binUrlStr = tag . getAttribute ( HtmlParserHTMLParser . ATT_SRC ) ; } else if ( node instanceof LinkTagTag ) { LinkTagTag script = ( ( LinkTagTag ) ( node ) ) ; if ( script . getAttribute ( HtmlParserHTMLParser . ATT_REL ) . equalsIgnoreCase ( HtmlParserHTMLParser . STYLESHEET ) ) { binUrlStr = script . getAttribute ( HtmlParserHTMLParser . ATT_HREF ) ; } } else if ( node instanceof FrameTag ) { FrameTag script = ( ( FrameTag ) ( node ) ) ; binUrlStr = script . getAttribute ( HtmlParserHTMLParser . ATT_SRC ) ; } else if ( node instanceof BgSoundTag ) { BgSoundTag script = ( ( BgSoundTag ) ( node ) ) ; binUrlStr = script . getAttribute ( HtmlParserHTMLParser . ATT_SRC ) ; } else if ( node instanceof Tag ) { Tag tag = ( ( Tag ) ( node ) ) ; String tagname = tag . getTagName ( ) ; if ( tagname . equalsIgnoreCase ( "EMBED" ) ) { binUrlStr = tag . getAttribute ( HtmlParserHTMLParser . ATT_SRC ) ; } } if ( binUrlStr == null ) { continue ; } urls . addURL ( binUrlStr , baseUrl ) ; } HtmlParserHTMLParser . log . debug ( "End<seq2seq4repair_space>:<seq2seq4repair_space>parseNodes" ) ; } catch ( ParserException e ) { throw new HTMLParseException ( e ) ; } return urls . iterator ( ) ; } private static void addTagListeners ( Parser parser ) { } }

Fix:
baseUrl = new URL ( baseUrl , baseref ) ;