Dear all,

I am using JESS 6.0a. I tried to serialize a rete object and reload it and I
got the following compile error. I can't figure out why? ( At first I was
using JESS 5.2, then switch to JESS 6 hoping to solve this problem, but this
problem persists)

The offending statement is the code below:
r.addOutputRouter("t",taw); // This is the offending statement

I checked the type of r after r has been reloaded and the class show
jess.Rete which is correct. Why does it cause a null pointer exception when
calling r.addOutputRouter?



/////////////////Save Rete Object///////////////////////

    try {
      FileOutputStream out   = new FileOutputStream("c:\\rete_save.dat");
      ObjectOutputStream os  = new ObjectOutputStream(out);
      os.writeObject(r);
      os.flush();
      out.close();
      os.close();
    } catch (Exception ie) {
      System.out.println("Cannot write to Rete Data File");
      System.out.println(ie);
    }

///////////////// Load Rete Object///////////

   try {
      FileInputStream in    = new FileInputStream("c:\\rete_save.dat");

      ObjectInputStream is  = new ObjectInputStream(in);

      r = (Rete) is.readObject();
      in.close();
      is.close();

    } catch (IOException ie) {
      r = new Rete();
    }

    TextAreaWriter taw = new TextAreaWriter(textArea1);

    r.addOutputRouter("t",taw); // This is the offending statement
    r.addOutputRouter("WSTDOUT",taw);
    r.addOutputRouter("WSTDERR",taw);

////////////////////Error//////////////////////

java.lang.NullPointerException

        at jess.Rete.addOutputRouter(Unknown Source)

        at guardian.RuleInputFrame.jbInit(RuleInputFrame.java:139)

        at guardian.RuleInputFrame.<init>(RuleInputFrame.java:39)

        at guardian.RuleInput.<init>(RuleInput.java:30)

        at guardian.RuleInput.main(RuleInput.java:59)



Anthony Mak


---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to