CIQ 3.0 and ByteArray with Dictionary

Former Member
Former Member
At the moment - with current beta 2 - it is not possible to store ByteArray to a Dictionary.
- is it by design? or will it be implemented?

dictionary.put(key,byteArray)

I only pray that Storage will accept ByteArray :confused:
  • Former Member
    Former Member
    What error are you receiving when attempting to put a ByteArray into a Dictionary? I don't see any reason this should fail.

    In the current beta, I don't believe ByteArray can be saved to Application Storage, but this should be working prior to the official release of 3.0.
  • Former Member
    Former Member
    Thanks Brian for coming back.

    There is no error at all - simply - dictionary remains empty after calling PUT method, that's why I believe - this is to be implemented.
    If you'd need test-case - I can create one - but I believe, this is quite straight forward

    Thanks for confirming that is should be handled by Storage - I'll assume in my project that it will work then.
  • So, I'm not able to reproduce a problem with the following simple testcase..

    System.println("A");
    var byte_array = []b;
    System.println(byte_array);

    System.println("B");
    var dict = {};
    System.println(dict);

    System.println("C");
    dict.put(1, byte_array);
    System.println(dict);


    I see the folloowing output..

    A
    []
    B
    {}
    C
    {1=>[]}


    I am seeing problems with using the byte array as a key in a dict, so I'll file something to add support for that. Unfortunately, I'm not able to reproduce the problem you describe, so this may be a case where a test case is warranted.
  • Former Member
    Former Member
    I'll create a test case and send it or post here - so it can be checked, just need a day or two.
  • Former Member
    Former Member
    Travis,

    First of all - my apologies - seems that error is not related to dictionary. I did not realize that, as it was related to a different error causing problem with compilation.

    Simplest case:

    var x = 09;

    causing compilation error:

    BUILD: ERROR: For input string: "9"
    BUILD: java.lang.NumberFormatException: For input string: "9"
    BUILD: at java.lang.NumberFormatException.forInputString(Unknown Source)

    And problem is valid whenever integer (passed to functions - which was exactly my case) is with 8 or 9 is leaded by 0

    Sometimes I'm using leading 0 to have a clearer reading.

    BTW

    var x = 05;

    would case no issue at all.
  • The 08 and 09 problem is because the leading zero is indicating Octal, and there is no 8 or 9 in octal.