swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java execution problem


From: Marcus G. Daniels
Subject: Re: Java execution problem
Date: 03 Dec 1999 16:19:55 -0800
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "DR" == david ROBIN <address@hidden> writes:

DR> and sometimes it crashes and i got the following error: "internal
DR> error Please check your CLASSPATH and your installation.
DR> Exception throw was of type 'java/lang/NullPointerException' NULL
DR> message"

I can't reproduce this.  Can you modify the program below to make the
crash happen?

DR> sketch of code

Please try to avoid the "sketch".  A little extra effort to make a
test program actually crash means that, in almost all cases (and
especially if you are an SDG member) that you will get an immediate
fix or explanation.

import swarm.Globals;
import swarm.collections.ListImpl;
import swarm.collections.List;
import swarm.objectbase.SwarmObjectImpl;

public class JavaCrash extends SwarmObjectImpl  {

  class Agent {
    Agent () {
      super ();
    }
    void ResetTabnote () {
    }
  }

  class Client {
    Client () {
      super ();
    }
    void setAgent (Agent agent) {
    }
    void setProb (double pprob, double dprob, double rprob, double aprob) {
    }
    void setProfil (int profil) {
    }
  }
  class Rapporteur {
    Rapporteur () {
      super ();
    }
    void setAgent (Agent agent) {
    }
    void setClient (Client client) {
    }
  }

  public JavaCrash () {
    final int nbPersonne = 10;
    final int nbmaxProfil = 10;
    final double PProb = .5;
    final double DProb = .5;
    final double RProb = .5;
    final double AProb = .5;

    int i;
    List ListeAgent, ListeClient, ListeRapporteur;
    
    ListeAgent = new ListImpl (getZone ());
    ListeClient = new ListImpl (getZone ());
    ListeRapporteur = new ListImpl (getZone ());
    
    // i fill the lists
    System.out.println ("creating agent list");
    for (i = 0; i < nbPersonne; i++)
      {
        Agent unAgent;
        
        unAgent = new Agent ();
        unAgent.ResetTabnote ();
        ListeAgent.addLast (unAgent);
      }
    
    System.out.println ("creating client list");
    for (i = 0;i < nbPersonne; i++)
      {
        int j;
        
        j = Globals.env.uniformIntRand.getIntegerWithMin$withMax
          (0, nbmaxProfil - 1);
        Client unClient;

        unClient = new Client ();
        unClient.setProb  (PProb, DProb, RProb, AProb);
        unClient.setProfil (j);
        ListeClient.addLast (unClient);
      }
    
    System.out.println ("creating reporter list");
    for (i = 0; i< nbPersonne; i++)
      {
        Rapporteur unRapporteur;
        unRapporteur = new Rapporteur();
        ListeRapporteur.addLast (unRapporteur);
      }

    System.out.println
      ("associating agents to clients and agents and clients to reporters");
    for (i = 0; i < nbPersonne; i++)
      {
        Agent unAgent;
        Client unClient;
        Rapporteur unRapporteur;

        unAgent = (Agent) ListeAgent.removeFirst ();
        unClient = (Client) ListeClient.removeFirst ();
        unRapporteur = (Rapporteur) ListeRapporteur.removeFirst ();
        System.out.println (unAgent + " " + unClient + " " + unRapporteur);

        unClient.setAgent (unAgent);
        unRapporteur.setAgent (unAgent);
        unRapporteur.setClient (unClient);
        ListeAgent.addLast (unAgent);
        ListeClient.addLast (unClient);
        ListeRapporteur.addLast (unRapporteur);
      }
    System.out.println ("done");
  }
  static public void main (String args []) {
    Globals.env.initSwarm ("JavaCrash", "0.0", "address@hidden",
                           args);
    JavaCrash obj = new JavaCrash ();
  }
}

Usage:
$ javacswarm JavaCrash.java
$ javaswarm JavaCrash
creating agent list
creating client list
creating reporter list
associating agents to clients and agents and clients to reporters
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden
done


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]