Home Help Center

IceV3.11 java client and vc7.0Server : java.lang.NullPointerException?

zhoubinzhoubin Member bin geOrganization: proffessionalProject: partyManage
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(APGInterfacePrxHelper.java:783)
at APG.APGInterfacePrxHelper.printftest(APGInterfacePrxHelper.java:769)
thank you!

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    This is expected. See the "Null Parameters" section in the Client-Side Slice-to-Java mapping chapter in the Ice manual.
  • zhoubinzhoubin Member bin geOrganization: proffessionalProject: partyManage
    thanks matthew:
    matthew wrote:
    This is expected. See the "Null Parameters" section in the Client-Side Slice-to-Java mapping chapter in the Ice manual.
    thank you,matthew.I will look up the Ice manual.
Sign In or Register to comment.