Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Corba > Structs and nul...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 438 of 552
Post > Topic >>

Structs and null pointer exceptions

by jamesb457@[EMAIL PROTECTED] Jun 29, 2006 at 12:11 PM

I have an IDL looking something like this

module LMS
{

  struct Alarm
  {
    string sensor;
    string zone;
  };

  interface LMSIF
  {
    void raise_alarm(in Alarm aReading);
    void send_alarm_to_rmc(in string alarm);
    string test_case();
  };
};

and a java file looking something like:

class LMSServant extends _LMSIFImplBase
{
   Alarm al;
   //functions here
  public LMSServ()
  {
      //this line causes the problem.
      al.sensor = "Sensor 1";
  }

}

The problem i'm having is when i try to modify or write to the Alarm
struct i get a NullPointerException every time.
Am i doing something wrong?

Do i need to define anything extra to get an IDL struct to work as a
java class?
I tried redefining Alarm as a class with the same variables but this
caused all sorts of other errors..

Any help appreciated :)
 




 2 Posts in Topic:
Structs and null pointer exceptions
jamesb457@[EMAIL PROTECTE  2006-06-29 12:11:13 
Re: Structs and null pointer exceptions
Piet van Oostrum <piet  2006-07-01 14:07:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 12:33:38 CDT 2008.