I'm a new ICE user,When I did a test.I Met a exception like the title.
I have a simple interface that looks like this:
#ifndef _APG_INTERFACE
#define _APG_INTERFACE
#include <CommonDef.ice>
module APG
{
struct Strategy
{
string id;
};
enum Type
{
a,
b,
c
};
struct Test
{
string id;
int n;
Type camptype;
Strategy strategyinfo;
};
interface APGInterface
{
long printftest(Test Campaign);
};
};
I have a test at the java client like below:
ic = Ice.Util.initialize();
Ice.ObjectPrx base = ic.stringToProxy(
"AppGateway:default -h 10.130.16.11 -p 10000");
APG.APGInterfacePrx apgInerprx = APG.APGInterfacePrxHelper.checkedCast(base);
Test ts = new Test();
ts.id ="nihoa";
ts.n= 3;
//ts.camptype = Type.a; //ts.strategyinfo = new Strategy();
apgInerprx.printftest(ts);
if I don't give value to the enum type "camptype ",or I don't give value to the struct type "strategyinfo ", I met exception like below:
java.lang.NullPointerException
at APG.Test.__write(Test.java:112)
at APG._APGInterfaceDelM.printftest(_APGInterfaceDelM .java:1193)
at APG.APGInterfacePrxHelper.printftest(APGInterfaceP rxHelper.java:783)
at APG.APGInterfacePrxHelper.printftest(APGInterfaceP rxHelper.java:769)
thank you!

Reply With Quote