Bug #3877


Exception occurs generating XML for FillInTheBlank blank question

Added by Ryan McFall over 15 years ago. Updated over 15 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


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(
at edu.msu.first.parser.question.Question.generateXML(
at edu.msu.first.parser.gui.MainWindow.importPDF(
at edu.msu.first.parser.gui.MainWindow$3.wizardCompleted(
at edu.msu.first.wizard.WizardFrame.fireWizardCompleted(
at edu.msu.first.wizard.WizardFrame.finish(


midterm-2009.pdf (67.5 KB) midterm-2009.pdf Ryan McFall, 03/10/2009 12:31 PM
Actions #1

Updated by Ryan McFall over 15 years ago

This is the file that causes the exception.

Actions #2

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.

Actions #3

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.

Actions #4

Updated by Sandeep Namilikonda over 15 years ago

Reason for Bug 3877: generateXML() in

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 ----------

Actions #5

Updated by Redmine Admin over 11 years ago

Original Bugzilla ID was 3877


Also available in: Atom PDF