Ticket #328 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

Java Null Pointer Pointer Exception sometimes occurs

Reported by: kmaclean Owned by: kmaclean
Priority: major Milestone: SpeechSubmission 0.1.4
Component: SpeechSubmission Version: SpeechSubmission0.1.3
Keywords: Cc:

Description

After switching back and forth between languages, get Java Null Pointer Pointer Exception. This one occurred when going from English to Dutch version of Speech Submission App.

java.lang.NullPointerException
	at java.util.StringTokenizer.<init>(Unknown Source)
	at java.util.StringTokenizer.<init>(Unknown Source)
	at speechrecorder.Prompts.getPromptLine(Prompts.java:105)
	at speechrecorder.Prompts.<init>(Prompts.java:88)
	at speechrecorder.CapturePlayback.<init>(CapturePlayback.java:346)
	at speechrecorder.RecorderApplet.init(RecorderApplet.java:43)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Change History

comment:1 Changed 12 years ago by kmaclean

  • Status changed from new to closed
  • Resolution set to fixed

Number of prompts must match the actual number of prompts in the text file:

public Prompts(int NumberofPrompts, String Language) {
	if (Language.equals("EN")) {
		promptList = getPromptTextFile("englishPromptList.txt", 1223); // number of prompts needs to be exact or there might be an error on a roll-over
	} else if (Language.equals("NL")) {
		promptList = getPromptTextFile("nl","dutchPromptList.txt", 813);
	} else if (Language.equals("DE")) {
		promptList = getPromptTextFile("germanPromptList.txt", 347);
	} else if (Language.equals("RU")) {
		promptList = getPromptTextFile("russianPromptList.txt", 81);	
	} else if (Language.equals("IT")) {
		promptList = getPromptTextFile("it","italianPromptList.txt", 1185);	
	} else if (Language.equals("HB")) {
		promptList = getPromptTextFile("hebrewPromptList.txt", 55);	
	} else {
        System.err.println("getPromptTextFile error accessing prompt file for "+ Language + "using default English prompts");
		promptList = englishPromptList;
	}
Note: See TracTickets for help on using tickets.