BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-15-2008, 08:43 AM   #1
myworldntl
New Member
 
Join Date: Jul 2008
Model: none
PIN: N/A
Carrier: none
Posts: 3
Default Newb Help??? - Uncaught Exception/ NoSuchFile.Java...?

Please Login to Remove!

Hi,

I'm new to blackberry development, and also to Java, so fun here... lol

Anyway, im trying to make a basic data entry page for now, i've not got as far as posting/saving the data yet, as i cant even get it to display on the simulator screen due to the following error(s)

--
'Uncaught exception thrown' displays as the JDE window Title, a load of:
'source code is not available'

Are repetivly displayed line after line in a 'NoSuchFile.Java' window within the JDE...

Also in the debug window, this message is shown:
'CodeStore.DependencyList.buildModuleDependencyLis t() took 10 - [16]'

And eventually, if i step though enough 'source code is not available' errors, then the following error is displayed on the simulators screen:

Uncaught Exception: java.lang.NullPointerException

Please see my code below, perhaps there is something very obvious wrong with it...??


Code:
/*
 * Main_File.java
 *
 * © <your company here>, 2003-2005
 * Confidential and proprietary.
 */

package com.rim.samples.Simon_Test;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;
import net.rim.device.api.i18n.*;



/*
 *
 * 
 */
public class Lombard extends UiApplication
{
        public static void main(String[] args)
        {
                //create a new instance of the application
                //and start the application on the event thread
                Lombard app = new Lombard();
                app.enterEventDispatcher();
        }

        public Lombard()
        {
                //display a new screen
                pushScreen(new LombardScreen());
        }
}


final class LombardScreen extends MainScreen
{
//declare variables for later use


//Client Name
private AutoTextEditField clientNameText;
//Age (for sales margin)
private EditField ageValue;
//Gender (for sales margin)
private ObjectChoiceField genderChoice;
//Product name
private AutoTextEditField prodNameText;
//Name
private ObjectChoiceField partnerNameChoice;
//Name
private AutoTextEditField partnerNameText;
//Address
private AutoTextEditField addressText;
//Telephone Number
private AutoTextEditField telNumberText;
//Can the investment to be in Goldlist?
private ObjectChoiceField goldlistChoice;
//Broker Initial Commission
private EditField initialCommValue;
//Allocation Rate
private EditField allocationRateValue;
//Bid/Offer Spread
private EditField bidOfferSpreadValue;
//Guaranteed Administration Charge
private EditField adminChargeValue;
//Selected Months - Guaranteed Administration Charge
private EditField monthsAdminChargeValue;
//Underlying asset charges (e.g. on mutual fund)A
private EditField assestChargeAValue;
//Underlying asset charges (e.g. on mutual fund)B
private EditField assestChargeBValue;
//Renewal Commission
private EditField renCommissionValue;
//Investment Advisory Fee
private EditField AdFeeValue;
//Establishment Charge
private EditField estChargeValue;
//Selected Months - Establishment Charge
private EditField monthsEstChargeValue;
//Selected Premium/Fund - Establishment Charge
private ObjectChoiceField premfunEstChargeChoice;
//Policy Fee
private EditField policyFeeValue;
//Surrender penalty (value not year dependent)
private EditField surrPenValue;
//Selected Months - Surrender penalty (value not year dependent)
private EditField monthsSurrPenValue;
//Selected Premium/Fund - Surrender penalty (value not year dependent)
private ObjectChoiceField premfunSurrPenChoice;
//Surrender Penalty at end of year t
private EditField surrPenEoyValue;
//% of Premium - Surrender Penalty at end of year t
private EditField perOfPremiumSurrPenEoyValue;
//Trailer fee to LIA (for sales margin check):
private EditField trailerFeeValue;
//Premium
private EditField premiumValue;
//Premium Currency
private ObjectChoiceField currencyChoice;
//Premium Frequency
private ObjectChoiceField premFreqChoice;
//Premium Term (only for non-single premium)
private EditField premTermValue;
//Partial Surrenders (only for single premium policies)
private EditField partialSurrValue;
//Taken As - Partial Surrenders (only for single premium policies)
private ObjectChoiceField takenAsPartialSurrChoice;



public LombardScreen()
        {
                //invoke the MainScreen constructor
                //super();

                //add a screen title
                LabelField title = new LabelField("Lombard Client Illustration System - Version 2.6",
                                LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
                setTitle(title);
                
                LabelField header1 = new LabelField("Client Details");
                add(header1);

                
                //add a text label
                add(clientNameText);
                add(ageValue);
                
                
                String choices1[] = {"Male", "Female"};
                genderChoice = new ObjectChoiceField("Gender", choices1);
                add(genderChoice);
                
                
                LabelField header2 = new LabelField("Product Details");
                add(header2);
                

                
                
                //Product name
                add(prodNameText);

                LabelField header3 = new LabelField("IFA Details");
                add(header3);


                //Name
                String choices2[] = {"Partner 1", "Partner 2", "Partner 3", "Partner 4", "Partner 5", "Partner 6", "Partner 7", "Partner 8", "Partner 9", "Partner 10", "Partner 11", "Partner 12", "Partner 13", "Partner 14", "Other"};
                partnerNameChoice = new ObjectChoiceField("Name", choices2);
                                add(partnerNameChoice);
                //Name
                add(partnerNameText);
                //Address
                add(addressText);
                //Telephone Number
                add(telNumberText);

                LabelField header4 = new LabelField("Fund Details");
                add(header4);



                //Can the investment to be in Goldlist?
                String choices3[] = {"No", "Yes"};
                goldlistChoice = new ObjectChoiceField("Can the investment to be in Goldlist?", choices3);
                                add(goldlistChoice);
                                

                LabelField header5 = new LabelField("Charges");
                add(header5);
                
                
                //Broker Initial Commission
                add(initialCommValue);
                //Allocation Rate
                add(allocationRateValue);
                //Bid/Offer Spread
                add(bidOfferSpreadValue);
                //Guaranteed Administration Charge
                add(adminChargeValue);
                //Selected Months - Guaranteed Administration Charge
                add(monthsAdminChargeValue);
                //Underlying asset charges (e.g. on mutual fund)A
                add(assestChargeAValue);
                //Underlying asset charges (e.g. on mutual fund)B
                add(assestChargeBValue);
                //Renewal Commission
                add(renCommissionValue);
                //Investment Advisory Fee
                add(AdFeeValue);
                //Establishment Charge
                add(estChargeValue);
                //Selected Months - Establishment Charge
                add(monthsEstChargeValue);
                
                //Selected Premium/Fund - Establishment Charge
                String choices4[] = {"Premium", "Fund"};
                premfunEstChargeChoice = new ObjectChoiceField("Establishment Charge", choices4);
                add(premfunEstChargeChoice);
                
                //Policy Fee
                add(policyFeeValue);
                //Surrender penalty (value not year dependent)
                add(surrPenValue);
                //Selected Months - Surrender penalty (value not year dependent)
                add(monthsSurrPenValue);
                
                //Selected Premium/Fund - Surrender penalty (value not year dependent)
                String choices5[] = {"Premium", "Fund"};
                premfunSurrPenChoice = new ObjectChoiceField("Surrender penalty (value not year dependent)", choices5);
                add(premfunSurrPenChoice);
                
                //Surrender Penalty at end of year t
                add(surrPenEoyValue);
                //% of Premium - Surrender Penalty at end of year t
                add(perOfPremiumSurrPenEoyValue);
                //Trailer fee to LIA (for sales margin check):
                add(trailerFeeValue);


                LabelField header6 = new LabelField("Other Assumptions");
                add(header6);


                //Premium
                add(premiumValue);
                
                //Premium Currency
                String choices6[] = {"ARP", "ATS", "AUD", "BEF", "CAD", "CHF", "DEM", "DKK", "ESP", "EUR", "FIM", "GBP", "FRF", "GRD", "IEP", "ITL", "JPY", "LUF", "NLG", "NOK", "NZD", "PTE", "SEK", "USD", "ZAR"};
                currencyChoice = new ObjectChoiceField("Premium Currency", choices6);
                add(currencyChoice);

                //Premium Frequency
                String choices7[] = {"Single", "Monthly", "Quarterly", "Twice Yearly", "Annually"};
                premFreqChoice = new ObjectChoiceField("Premium Frequency", choices7);
                add(premFreqChoice);

                
                //Premium Term (only for non-single premium)
                add(premTermValue);
                //Partial Surrenders (only for single premium policies)
                add(partialSurrValue);
                
                
                //Taken As - Partial Surrenders (only for single premium policies)
                String choices8[] = {"Monthly", "Quarterly", "Twice Yearly", "Annually"};
                takenAsPartialSurrChoice = new ObjectChoiceField("", choices8);
                add(takenAsPartialSurrChoice);                
         }

        //override onClose() to display a dialog box
        //when the application is closed
        public boolean onClose()
        {
                Dialog.alert("Goodbye!");
                System.exit(0);
                return true;
                }

private MenuItem _closeItem = new MenuItem("Close", 200000, 10) {
                public void run()
                {
                        onClose();
                }
        };

        //override makeMenu to add the new menu items
        protected void makeMenu( Menu menu, int instance )
        {
                menu.add(_closeItem);
        }


}
Offline  
Old 07-15-2008, 11:39 AM   #2
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

At first glance I don't see where you assign values to clientNameText or ageValue (BTW your comment style in your declaration section makes it very difficult to read, for me anyway) before you add() them to the screen. This could be the cause of the NullPointerException.

The reason the JDE/Debugger behave the way you describe is that the exception is thrown in the MainScreen (or some super class) for which you don't have debugging data. Since the exception is not caught in your app, the only other option for the JDE is to let the Java environment catch it by terminating your app, which wouldn't help you debug.

When you see that happen, somewhere in the JDE there should be a method call history. In the list of Calling Methods should be one of yours. If you select it the source screen will show you the file/line being executed when the exception was thrown.
Offline  
Old 07-16-2008, 02:39 AM   #3
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

I think thaht hrbuckley is right.

Sometimes I have this kind of error and it allways when I try to add something null to the screen.

Check each variable you have
Offline  
Old 07-16-2008, 02:58 AM   #4
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

The Exception should be thrown at

add(clientNameText);

as you are adding null to the screen as goulmass and hrbuckley mentioned.
you have first to create instances of all your fields you want to add to the screen before adding them

Last edited by Ivanov; 07-16-2008 at 02:59 AM..
Offline  
Old 07-16-2008, 03:08 AM   #5
myworldntl
New Member
 
Join Date: Jul 2008
Model: none
PIN: N/A
Carrier: none
Posts: 3
Default Thanks

Hi,

Thanks everyone, double checked everything as suggested and seemed to get it working...

Main problem is i have no idea about java or the JDE atm, so it's very much a learning experience, lol.

Thanks for all your help though, now i just need to figure out how to get everything else to work that i want it to do, lol, but I need to walk before i can run right, ha ha :D

Anyhow, this is the updated code which now works, and thanks again.

Code:
package com.rim.samples.Simon_Test;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;
import net.rim.device.api.i18n.*;



public class Lombard extends UiApplication
{
        public static void main(String[] args)
        {
                Lombard app = new Lombard();
                app.enterEventDispatcher();
        }

        public Lombard()
        {
                pushScreen(new LombardScreen());
        }
}


final class LombardScreen extends MainScreen
{
//Gender (for sales margin)
private ObjectChoiceField genderChoice;

//Name
private ObjectChoiceField partnerNameChoice;

//Can the investment to be in Goldlist?
private ObjectChoiceField goldlistChoice;

//Selected Premium/Fund - Establishment Charge
private ObjectChoiceField premfunEstChargeChoice;

//Selected Premium/Fund - Surrender penalty (value not year dependent)
private ObjectChoiceField premfunSurrPenChoice;

//Premium Currency
private ObjectChoiceField currencyChoice;

//Premium Frequency
private ObjectChoiceField premFreqChoice;

//Taken As - Partial Surrenders (only for single premium policies)
private ObjectChoiceField takenAsPartialSurrChoice;





public LombardScreen()
        {
                super();

                LabelField title = new LabelField("Lombard Demo", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
                setTitle(title);
                
                LabelField header1 = new LabelField("Client Details: -", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
                add(header1);
                
                //Seperator
                SeparatorField myLine = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(myLine);

                //Client Name
                AutoTextEditField clientNameText = new AutoTextEditField("Client Name: ", "");
                add(clientNameText);                               
                
                //Age
                EditField ageValue = new EditField("Age: ", "");
                add(ageValue);
                
                //Gender
                String choices1[] = {"Male", "Female"};
                genderChoice = new ObjectChoiceField("Gender", choices1);
                add(genderChoice);
                
                //HEADER & Seperators - Product Details
                SeparatorField header2Top = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header2Top);
                LabelField header2 = new LabelField("Product Details: -");
                add(header2);
                SeparatorField header2Bot = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header2Bot);
                
                
                //Product name
                AutoTextEditField prodNameText = new AutoTextEditField("Product name: ", "");
                add(prodNameText);

                //HEADER & Seperators - IFA Details
                SeparatorField header3Top = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header3Top);
                LabelField header3 = new LabelField("IFA Details: -");
                add(header3);
                SeparatorField header3Bot = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header3Bot);

                //Name
                String choices2[] = {"Partner 1", "Partner 2", "Partner 3", "Partner 4", "Partner 5", "Partner 6", "Partner 7", "Partner 8", "Partner 9", "Partner 10", "Partner 11", "Partner 12", "Partner 13", "Partner 14", "Other"};
                partnerNameChoice = new ObjectChoiceField("Name", choices2);
                                add(partnerNameChoice);
                //Name
                AutoTextEditField partnerNameText = new AutoTextEditField("Name: ", "");
                add(partnerNameText);
                
                //Address
                AutoTextEditField addressText = new AutoTextEditField("Address: ", "");
                add(addressText);
                
                //Telephone Number
                BasicEditField telNumberText = new AutoTextEditField("Telephone Number: ", "");
                add(telNumberText);

                //HEADER & Seperators - Fund Details
                SeparatorField header4Top = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header4Top);
                LabelField header4 = new LabelField("Fund Details: -");
                add(header4);
                SeparatorField header4Bot = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header4Bot);


                //Can the investment to be in Goldlist?
                String choices3[] = {"No", "Yes"};
                goldlistChoice = new ObjectChoiceField("Can invest in Goldlist?", choices3);
                                add(goldlistChoice);
                
                //HEADER & Seperators - Charges
                SeparatorField header5Top = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header5Top);
                LabelField header5 = new LabelField("Charges: -");
                add(header5);
                SeparatorField header5Bot = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header5Bot);                
                
                //Broker Initial Commission
                EditField initialCommValue = new EditField("Broker Initial Commission: ", "");
                add(initialCommValue);
                
                //Allocation Rate
                EditField allocationRateValue = new EditField("Allocation Rate: ", "");
                add(allocationRateValue);
                
                //Bid/Offer Spread
                EditField bidOfferSpreadValue = new EditField("Bid/Offer Spread: ", "");
                add(bidOfferSpreadValue);
                
                //Guaranteed Administration Charge
                EditField adminChargeValue = new EditField("Guaranteed Administration Charge: ", "");
                add(adminChargeValue);
                
                //Selected Months - Guaranteed Administration Charge
                EditField monthsAdminChargeValue = new EditField("Guaranteed Administration Charge: ", "");
                add(monthsAdminChargeValue);
                
                //Underlying asset charges (e.g. on mutual fund)A
                EditField assestChargeAValue = new EditField("Underlying asset charges (e.g. on mutual fund)A: ", "");
                add(assestChargeAValue);
                
                //Underlying asset charges (e.g. on mutual fund)B
                EditField assestChargeBValue = new EditField("Underlying asset charges (e.g. on mutual fund)B: ", "");
                add(assestChargeBValue);
                
                //Renewal Commission
                EditField renCommissionValue = new EditField("Renewal Commission: ", "");
                add(renCommissionValue);
                
                //Investment Advisory Fee
                EditField AdFeeValue = new EditField("Investment Advisory Fee: ", "");
                add(AdFeeValue);
                
                //Establishment Charge
                EditField estChargeValue = new EditField("Establishment Charge: ", "");
                add(estChargeValue);
                
                //Selected Months - Establishment Charge
                EditField monthsEstChargeValue = new EditField("Establishment Charge: ", "");
                add(monthsEstChargeValue);
                
                //Selected Premium/Fund - Establishment Charge
                String choices4[] = {"Premium", "Fund"};
                premfunEstChargeChoice = new ObjectChoiceField("Establishment Charge", choices4);
                add(premfunEstChargeChoice);
                
                //Policy Fee
                EditField policyFeeValue = new EditField("Policy Fee: ", "");
                add(policyFeeValue);
                
                //Surrender penalty (value not year dependent)
                EditField surrPenValue = new EditField("Surrender penalty (value not year dependent): ", "");
                add(surrPenValue);
                
                //Selected Months - Surrender penalty (value not year dependent)
                EditField monthsSurrPenValue = new EditField("Surrender penalty (value not year dependent): ", "");
                add(monthsSurrPenValue);
                
                //Selected Premium/Fund - Surrender penalty (value not year dependent)
                String choices5[] = {"Premium", "Fund"};
                premfunSurrPenChoice = new ObjectChoiceField("Surrender penalty (value not year dependent)", choices5);
                add(premfunSurrPenChoice);
                
                //Surrender Penalty at end of year t
                EditField surrPenEoyValue = new EditField("Surrender Penalty at end of year t: ", "");
                add(surrPenEoyValue);
                
                //% of Premium - Surrender Penalty at end of year t
                EditField perOfPremiumSurrPenEoyValue = new EditField("Surrender Penalty at end of year t: ", "");
                add(perOfPremiumSurrPenEoyValue);
                
                //Trailer fee to LIA (for sales margin check):
                EditField trailerFeeValue = new EditField("Trailer fee to LIA (for sales margin check): ", "");
                add(trailerFeeValue);

                //HEADER & Seperators - Other Assumptions
                SeparatorField header6Top = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header6Top);
                LabelField header6 = new LabelField("Other Assumptions: -");
                add(header6);
                SeparatorField header6Bot = new SeparatorField(SeparatorField.LINE_HORIZONTAL);
                add(header6Bot);

                //Premium
                EditField premiumValue = new EditField("Premium: ", "");
                add(premiumValue);
                
                //Premium Currency
                String choices6[] = {"ARP", "ATS", "AUD", "BEF", "CAD", "CHF", "DEM", "DKK", "ESP", "EUR", "FIM", "GBP", "FRF", "GRD", "IEP", "ITL", "JPY", "LUF", "NLG", "NOK", "NZD", "PTE", "SEK", "USD", "ZAR"};
                currencyChoice = new ObjectChoiceField("Premium Currency", choices6);
                add(currencyChoice);

                //Premium Frequency
                String choices7[] = {"Single", "Monthly", "Quarterly", "Twice Yearly", "Annually"};
                premFreqChoice = new ObjectChoiceField("Premium Frequency", choices7);
                add(premFreqChoice);

                
                //Premium Term (only for non-single premium)
                EditField premTermValue = new EditField("Premium Term (only for non-single premium): ", "");
                add(premTermValue);
                
                //Partial Surrenders (only for single premium policies)
                EditField partialSurrValue = new EditField("Partial Surrenders (only for single premium policies): ", "");
                add(partialSurrValue);
                
                
                //Taken As - Partial Surrenders (only for single premium policies)
                String choices8[] = {"Monthly", "Quarterly", "Twice Yearly", "Annually"};
                takenAsPartialSurrChoice = new ObjectChoiceField("", choices8);
                add(takenAsPartialSurrChoice);                
         }

        //override onClose() to display a dialog box when the application is closed
        public boolean onClose()
        {
                Dialog.alert("Goodbye!");
                System.exit(0);
                return true;
                }

private MenuItem _closeItem = new MenuItem("Close", 200000, 10) {
                public void run()
                {
                        onClose();
                }
        };

        //override makeMenu to add the new menu items
        protected void makeMenu( Menu menu, int instance )
        {
                menu.add(_closeItem);
        }


}
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16) picture

Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16)

$189.99



Niedermaier vintage Mannequins Visual Display Props Dec. 1991 Catalogue picture

Niedermaier vintage Mannequins Visual Display Props Dec. 1991 Catalogue

$141.00



VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250 picture

VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250

$79.99



Adec Vintage Adjusting Dentist Doctor Medical Stool Rolling Swivel Chair picture

Adec Vintage Adjusting Dentist Doctor Medical Stool Rolling Swivel Chair

$199.99



HSS 12pcs Valve Seat & Face Cutter 45dec 30dec 20dec for Vintage Car, Bikes ,Jee picture

HSS 12pcs Valve Seat & Face Cutter 45dec 30dec 20dec for Vintage Car, Bikes ,Jee

$235.94



Onan Electric Generating Plants Manual And Parts Catalog DEC Series 1963 Vintage picture

Onan Electric Generating Plants Manual And Parts Catalog DEC Series 1963 Vintage

$13.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.