Subject: Optional arguments for agents
From: Heiko Holtschneider (heiko.holtschneider@post.rwth-aachen.de)
Date: Tue Oct 22 2002 - 17:17:10 MET DST
Dear JADErs,
I experience the following problem when giving agents some optional
arguments on start-up:
When starting an agent over the command line the argument is either null
(no argument passed to the agent) or it is the specified String Object.
In my programm I check for null.
However, when I try to start an agent (without argument) with the RMA,
something else must be passed to the agent. I get a
java.lang.ArrayIndexOutOfBoundsException. I marked the line the
exception occurrs.
What am I doing wrong? And how else could I check whether an argument
is passed to the agent or not?
I attached the code-snipplet I check for the argument with.
Thanks in advance for any help,
Heiko
===================================================================
Object[] argFN;
if((argFN = getArguments())==null) {
System.out.println("NULL NULL");
configFN=null;
}
else {
--->>>> System.out.println("\nconfFN:"+(String)argFN[0]);
configFN = (String)argFN[0];
}
===================================================================
-- Heiko Holtschneider mailto:heiko.holtschneider@post.rwth-aachen.de
This archive was generated by hypermail 2a22 : Tue Oct 22 2002 - 17:17:59 MET DST