Bug #3877
closedException occurs generating XML for FillInTheBlank blank question
0%
Description
When attempting to import my computer graphics exam from this semester, which I will attach, I get the following exception on pressing the Finish button in the wizard:
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at edu.msu.first.parser.question.FillInTheBlankResponseItem.generateXML(FillInTheBlankResponseItem.java:82)
at edu.msu.first.parser.question.Question.generateXML(Question.java:180)
at edu.msu.first.parser.gui.MainWindow.importPDF(MainWindow.java:690)
at edu.msu.first.parser.gui.MainWindow$3.wizardCompleted(MainWindow.java:591)
at edu.msu.first.wizard.WizardFrame.fireWizardCompleted(WizardFrame.java:330)
at edu.msu.first.wizard.WizardFrame.finish(WizardFrame.java:230)
Files
Updated by Ryan McFall over 15 years ago
This is the file that causes the exception.
Updated by Ryan McFall over 15 years ago
Notes: I drew a "header" selection around the heading at the top of the document, and also ignored the introductory text on the first page. I also draw boxes around the two vector images which are simply empty rectangles on two separate pages. I suspect the error occurs without these two actions, however.
Updated by Ryan McFall over 15 years ago
I'm wrong about the error occurring without the actions mentioned in comment #2. The header selection is not important; but if you don't do the image rasterization process on pages 2 and 3, the error does not occur.
Updated by Sandeep Namilikonda over 15 years ago
Reason for Bug 3877: generateXML() in FillInTheBlankResponseItem.java
while(condition1) {
while(condition2) // condition1 violation is not caught here!
// resulted in stringOutOfBound access!
{}
}
Fix: Simple modification to the inside while() to check for cond1 && cond2 resolved the issue!
The violation is only caught when the "blank" appears at the end of the question text! When the image corresponding to question 2 is not scanned explicitly by the user, the last blank is not at the end of the question text. e.g.,
------ Start snippet ---------
...
...
at the far left edge. The shape of the object should remain the same. (3
pts) Line # to change: _ New contents:
______________________________________ c. Draw the contents of the
screen window if the code from part (a) above were modified as follows
...
...
----- End of snippet ----------