Project

General

Profile

Bug #3877

Exception occurs generating XML for FillInTheBlank blank question

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

Status:
Resolved
Priority:
Normal
Category:
parser
Target version:
Start date:
03/10/2009
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
3877

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)

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

History

#1 Updated by Ryan McFall over 11 years ago

This is the file that causes the exception.

#2 Updated by Ryan McFall over 11 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.

#3 Updated by Ryan McFall over 11 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.

#4 Updated by Sandeep Namilikonda over 11 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 ----------

#5 Updated by Redmine Admin over 7 years ago

Original Bugzilla ID was 3877

Also available in: Atom PDF