line 43 add statement
if(markdown.charAt(nextOpenBracket - 1) != '!')
This change intends to address the incorrect output caused by a image link. Image link should not be included in the collections of URLs.The if
statement prevent any image link to be added to the output.
bug: program would read image links
link to the failure-inducing input:
failure-inducing input-1
symptom: image link included in the output
line 43 changed to:
if(nextOpenBracket==0 || markdown.charAt(nextOpenBracket - 1) != '!')
This change intends to address the StringIndexOutOfBoundsException thrown when running the program after change No.1 with a input file that begins with a closed bracket [
bug: program throws error when the input file starts with a [
link to the failure-inducing input:
failure-inducing input-2
symptom: StringIndexOutOfBoundsException
thrown
line 43 changed to:
if (nextCloseBracket+1==openParen && (nextOpenBracket ==0 || markdown.charAt(nextOpenBracket - 1) != '!'))
This change intends to address the incorrect output when input a file that has pairs of close brackets []
and open brackets ()
that are not adjacent, which means the close and open brackets are not used for link.
bug: program would include content in a pair of open bracket while it's not adjacent to a prior pair of closed bracker, which means the text within is not a URL.
link to the failure-inducing input:
failure-inducing input-3
symptom: ppap isn't a URL but included in the output.