cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
147
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: null on 10-11-2003 06:39:23 AM
The following code throwing a nullpointer exception. Can you just check the code and tell me what is wrong?[code:1:eefab7b86f]import java.util.*;

import com.audium.server.action.database.*;

import com.audium.server.proxy.VoiceElementInterface;
import com.audium.server.AudiumException;
import com.audium.server.session.ElementAPI;
import com.audium.server.xml.VoiceElementConfig;

public class PhoneList implements VoiceElementInterface
{

public VoiceElementConfig getConfig( String name,
ElementAPI elementAPI,
VoiceElementConfig defaults) throws AudiumException
{
VoiceElementConfig.AudioGroup initial = defaults.getAudioGroup("initial_audio_group", 1);
ResultSetList result = (ResultSetList)elementAPI.getSessionData("reception");

System.out.println("Value inside the phoneLIST");
// Iterate through the list of values stored in the ResultSetList object
// created from the database action
for &#40;int i = 0; i < result.getNumRows&#40;&#41;; i++&#41;
&#123;
System.out.println&#40;"The name inside for loop phoneLIST is " + result.getValue&#40;"name", i&#41; &#41;;
System.out.println&#40;"Extension inside the for loop phoneLIST ext is " + result.getValue&#40;"extension", i&#41; &#41;;

defaults.addSettingValue&#40;"voice_keyword", result.getValue&#40;"name", i&#41; + "&#91;" + result.getValue&#40;"name", i&#41; + "&#93;"&#41;;
System.out.println&#40;"defaults in the for loop are "&#41;;
&#125;
System.out.println&#40;"defaults are "&#41;;

// Return the Voice Element Configuration.*/
return defaults;
&#125;
&#125;
[/code:1:eefab7b86f]
It geerates an error when it reaches the folowing line of code[code:1:eefab7b86f]defaults.addSettingValue&#40;"voice_keyword", result.getValue&#40;"name", i&#41; + "&#91;" + result.getValue&#40;"name", i&#41; + "&#93;"&#41;;[/code:1:eefab7b86f]

The error is
[code:1:eefab7b86f]172.17.1.193.1068446009243.0.Rec1,11/10/2003 17&#58;34&#58;07,An error has occurred.
java.lang.NullPointerException
at PhoneList.getConfig&#40;PhoneList.java&#58;17&#41;
at com.audium.server.voiceElement.VoiceElementBase.determineConfig&#40;Unknown Source&#41;
at com.audium.server.voiceElement.VoiceElementBase.service&#40;Unknown Source&#41;
at com.audium.server.controller.Controller.if&#40;Unknown Source&#41;
at com.audium.server.controller.Controller.for&#40;Unknown Source&#41;
at com.audium.server.controller.Controller.a&#40;Unknown Source&#41;
at com.audium.server.controller.Controller.for&#40;Unknown Source&#41;
at com.audium.server.controller.Controller.a&#40;Unknown Source&#41;
at com.audium.server.controller.Controller.doPost&#40;Unknown Source&#41;
at com.audium.server.controller.Controller.doGet&#40;Unknown Source&#41;[/code:1:eefab7b86f]

Subject: RE: VoiceElementCofig
Replied by: null on 11-11-2003 06:15:35 PM
Hi Jaison,

The null pointer stack trace says it occurs on line 17 which is the first line in your method not the line you listed.

This is a dynamic voice element configuration class. The argument "defaults" contains the base configuration in it. If you chose not to have a base configuration in the Audium Builder, this argument will be null. This seems to be what is happening in your code. When you call defaults.getAudioGroup it throws the exception. So make sure you have a base configuration in the Audium Builder and you will not get a null pointer here.

Hope this helps.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links