Archived

This forum has been archived. Please start a new discussion on GitHub.

slice2java

ICE version 3.01

I use slice2java --stream to produce some java code from slice. But the code produced shows some problem with Ice.StringSeqHelper's read and write methods. the code call this methods with a InputStream or OutputStream parameter while StringSeqHelper class requires with BasicStream.

what is the wrong?

Comments

  • matthew
    matthew NL, Canada
    You need to provide much more information when you ask for help, otherwise its impossible for us to help.

    Please provide the slice file you are trying to compile, the slice2java command you are using, the Ice version, the JDK version you are using and the error messages that occur when you try to compile.
  • matthew wrote:
    You need to provide much more information when you ask for help, otherwise its impossible for us to help.

    Please provide the slice file you are trying to compile, the slice2java command you are using, the Ice version, the JDK version you are using and the error messages that occur when you try to compile.

    slice: (parts)

    1. in modul management
    struct UUID {
    string idString;
    };

    2. in module SourceServer
    struct ResourceUrl {
    short resClass;
    management::UUID resId;
    };

    struct Resource {
    ResourceUrl resUrl;
    int refCount;
    Ice::StringSeq components;
    };

    slice2java command:

    slice2java --stream --output-dir src -I*** -I*** ***
    Ice version

    3.01
    JDK:
    java version "1.5.0_06"
    No slice2java runtime errors

    Java doesn't need to complie

    actually, there are serveral slice files with lots ice object. only with one
    Resource.java with this problem

    part of Resource.java code
    ...
    public void
    __write(Ice.OutputStream __outS)
    {
    resUrl.__write(__outS);
    __outS.writeInt(refCount);
    Ice.StringSeqHelper.write(__outS, components); //here the problem
    }

    public void
    __read(Ice.InputStream __inS)
    {
    resUrl = new ResourceUrl();
    resUrl.__read(__inS);
    refCount = __inS.readInt();
    components = Ice.StringSeqHelper.read(__inS); //here the problem
    }
  • matthew
    matthew NL, Canada
    The problem is that streaming support is not generated for the builtin sequence types so therefore the correct override is not present for the Ice::StringSeq. We will discuss this issue internally. However, in the meantime what you can do is add your own sequence<string> type ... something like:
    sequence<string> MyStringSeq; 
    struct Resource
    {
    ResourceUrl resUrl;
    int refCount;
    MyStringSeq components;
    };
    
  • hai,Chen.I am from Beijing too and I am learning Ice now.
    My MSN is w_sea78@hotmail.com.We can exchange and
    share the knowledge about Ice.:)