You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Dinesh Akhand <di...@amdocs.com> on 2017/08/28 12:16:00 UTC

Bug while parsing the JSON "key which having short data type" in locate command

Hi Team,

I have found one bug in geode 1.2 .

If in the key we having the short data type

Example:

public class EmpData  implements Serializable{
private short empid;

public short getEmpid() {
       return empid;
}

public void setEmpid(short empid) {
       this.empid = empid;
}


EmpData d1 = new EmpData();
D1. setEmpid((short)1);

Region.put(d1,"value1");

Now try locate command on this .


Problem in code: file JSONTokener.java. it always return short to int value

try {
        long longValue = Long.parseLong(number, base);
        if(longValue <= Short.MAX_VALUE && longValue >= Short.MIN_VALUE)
        {
             return (short) longValue;
        }
        else if (longValue <= Integer.MAX_VALUE && longValue >= Integer.MIN_VALUE) {
          return (int) longValue;
        } else {
          return longValue;
        }

Later it cause the problem of java.lang.IllegalArgumentException: argument type mismatch.
locate entry --key=--key=('empid ':1) --region=CUSTOMER_1

alternate way :  changes the  DataCommandFunctionJUnitTest.java changes the testLocateKeyIsObject method

due to same problem, we are facing problem with all commands where we usage the key.

Thanks,
Dinesh Akhand


This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement,

you may review at https://www.amdocs.com/about/email-disclaimer <https://www.amdocs.com/about/email-disclaimer>