cse15l-lab-reports

Week 4 Lab Report 2

Fixing Bugs

By: Francisco Garcia

Course: CSE15L


CODE CHANGE #1 Image

Here is test-file1 for the first failure-induced input.

Image

Relationship between sympton-failure induced input-bug: Within the example, the symptom produced from the failure-induced input (e.g. the contents) in test-file1.md was caused by a bug found within the body of the while-loop where toReturn.add(markdown.substring(openParen + 1, closeParen)) returned the first line of contents although it should not have since it is not a link. This symptom occurred from including the contents of the first line in test-file1.md, where there was only one openbracket and no closed brackets. This failure-induced input caused the bug to return all of the contents in the file since openParen returned -1, and therefore toReturn was then assigned the String of all of the contents in test-file1.md, producing the symptom.


CODE CHANGE #2 Image

Here is test-file2 for the second failure-induced input.

Image

Relationship between sympton-failure induced input-bug: Within the example, the symptom produced from the failure-induced input (e.g. the contents) in test-file2.md was the output: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 14. The bug that was producing this symptom was also found in the body of the while-loop where toReturn.add(markdown.substring(openParen + 1, closeParen)) was attempting to assign toReturn with the substring of the contents of test-file2.md starting from -1 + 1 to -1. This is true since openParen and closeParen returned -1 since there were NOT any open or closed parentheses in the failure-induced input, causing this bug to procure the specific java.lang.StringIndexOutOfBoundsException symptom.


CODE CHANGE #3 Image

Here is test-file3 for the third failure-induced input.

Image

Relationship between sympton-failure induced input-bug: Within the example, the symptom produced from the failure-induced input (e.g. the contents) in test-file3.md was the output: java.lang.OutOfMemoryError. This implies that there was a bug in our code that was causing an infinite-loop which led to the program exceeding the Java heap space. After careful observation, we found that the bug was within the while-loop in which the condition currentIndex < markdown.length() was always true since currentIndex was always 0 and less than the length of the contents in test-file3.md, whenever there were no brackets in the failure-induced input.


Date: January 28, 2022