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/09/01 04:12:16 UTC

RE: [DISCUSS] Bug while parsing the JSON "key which having short data type" in locate command "https://github.com/apache/geode/pull/752"

Hi Team,

Please reply over below mail chain.

Need you focus on the issue.

Thanks,
Dinesh Akhand

-----Original Message-----
From: Dinesh Akhand 
Sent: Thursday, August 31, 2017 7:04 PM
To: dev@geode.apache.org
Subject: [DISCUSS] Bug while parsing the JSON "key which having short data type" in locate command "https://github.com/apache/geode/pull/752"

Hi,



I have created the pull request for the same .

https://github.com/apache/geode/pull/752



Jira ticket GEODE-3544.



Case 1)



Short data type is getting converted into integer &  geode is looking for set method  with integer

And it throws the exception.



So I am converting the value with parameterType  using ConvertUtils.convert which solve the problem for all primitive/wrapper type

            Example 2)

                         If key data type in short i =5

                              It will look for method  seti(integer )

Case 2) If key having the base class it check only key class set method .



So I change getDeclaredMethods to getMethods()





Thanks,

Dinesh Akhand



-----Original Message-----
From: Dinesh Akhand
Sent: Monday, August 28, 2017 5:46 PM
To: dev@geode.apache.org
Subject: 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>
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>
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>


RE: [DISCUSS] Bug while parsing the JSON "key which having short data type" in locate command "https://github.com/apache/geode/pull/752"

Posted by Dinesh Akhand <di...@amdocs.com>.
Hi Team,

I fixed the first review code comments. Please review again.

Thanks,
Dinesh Akhand

-----Original Message-----
From: dinesh 1004 [mailto:dineshpune2006@gmail.com] 
Sent: Wednesday, September 6, 2017 10:23 PM
To: dev@geode.apache.org
Subject: RE: [DISCUSS] Bug while parsing the JSON "key which having short data type" in locate command "https://github.com/apache/geode/pull/752"

Need suggestions on same pull request

Thanks,
Dinesh

On 1 Sep 2017 09:46, "Dinesh Akhand" <di...@amdocs.com> wrote:

> Hi Team,
>
> Please reply over below mail chain.
>
> Need you focus on the issue.
>
> Thanks,
> Dinesh Akhand
>
> -----Original Message-----
> From: Dinesh Akhand
> Sent: Thursday, August 31, 2017 7:04 PM
> To: dev@geode.apache.org
> Subject: [DISCUSS] Bug while parsing the JSON "key which having short 
> data type" in locate command "https://github.com/apache/geode/pull/752"
>
> Hi,
>
>
>
> I have created the pull request for the same .
>
> https://github.com/apache/geode/pull/752
>
>
>
> Jira ticket GEODE-3544.
>
>
>
> Case 1)
>
>
>
> Short data type is getting converted into integer &  geode is looking 
> for set method  with integer
>
> And it throws the exception.
>
>
>
> So I am converting the value with parameterType  using 
> ConvertUtils.convert which solve the problem for all primitive/wrapper 
> type
>
>             Example 2)
>
>                          If key data type in short i =5
>
>                               It will look for method  seti(integer )
>
> Case 2) If key having the base class it check only key class set method .
>
>
>
> So I change getDeclaredMethods to getMethods()
>
>
>
>
>
> Thanks,
>
> Dinesh Akhand
>
>
>
> -----Original Message-----
> From: Dinesh Akhand
> Sent: Monday, August 28, 2017 5:46 PM
> To: dev@geode.apache.org
> Subject: 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>
> 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>
> 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>
>
>
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>

RE: [DISCUSS] Bug while parsing the JSON "key which having short data type" in locate command "https://github.com/apache/geode/pull/752"

Posted by dinesh 1004 <di...@gmail.com>.
Need suggestions on same pull request

Thanks,
Dinesh

On 1 Sep 2017 09:46, "Dinesh Akhand" <di...@amdocs.com> wrote:

> Hi Team,
>
> Please reply over below mail chain.
>
> Need you focus on the issue.
>
> Thanks,
> Dinesh Akhand
>
> -----Original Message-----
> From: Dinesh Akhand
> Sent: Thursday, August 31, 2017 7:04 PM
> To: dev@geode.apache.org
> Subject: [DISCUSS] Bug while parsing the JSON "key which having short data
> type" in locate command "https://github.com/apache/geode/pull/752"
>
> Hi,
>
>
>
> I have created the pull request for the same .
>
> https://github.com/apache/geode/pull/752
>
>
>
> Jira ticket GEODE-3544.
>
>
>
> Case 1)
>
>
>
> Short data type is getting converted into integer &  geode is looking for
> set method  with integer
>
> And it throws the exception.
>
>
>
> So I am converting the value with parameterType  using
> ConvertUtils.convert which solve the problem for all primitive/wrapper type
>
>             Example 2)
>
>                          If key data type in short i =5
>
>                               It will look for method  seti(integer )
>
> Case 2) If key having the base class it check only key class set method .
>
>
>
> So I change getDeclaredMethods to getMethods()
>
>
>
>
>
> Thanks,
>
> Dinesh Akhand
>
>
>
> -----Original Message-----
> From: Dinesh Akhand
> Sent: Monday, August 28, 2017 5:46 PM
> To: dev@geode.apache.org
> Subject: 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>
> 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>
> 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>
>
>