You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Nils Hügelmann (JIRA)" <ji...@apache.org> on 2011/04/19 00:23:06 UTC

[jira] [Issue Comment Edited] (THRIFT-1150) List Deserialization with jQuery doesnt work

    [ https://issues.apache.org/jira/browse/THRIFT-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021313#comment-13021313 ] 

Nils Hügelmann edited comment on THRIFT-1150 at 4/18/11 10:22 PM:
------------------------------------------------------------------

I am using c# as server. I have made some tests:

{noformat}
struct foo{
  1: string test1,
  2: i32 test2,
  3: i32 test3,
}

struct foo2{
  1: string test1,
  2: i32 test2
}

service tester{
  list<foo> test1()
  list<foo2> test2()
}
{noformat}

h3. test1 with all variables set
{noformat}
public List<foo> test1(){
	return new List<foo> (){
		new foo(){
			Test1="s",
			Test2=2,
			Test3=3
		}
	};
}
{noformat}
->
{noformat}
[1,"test1",2,0,{"0":{"lst":["rec",1,{"1":{"str":"s"},"2":{"i32":2},"3":{"i32":3}}]}}]
{noformat}
->
jQ: "this.rstack[this.rstack.length - 1] is undefined" / thrift.js 662
eval(): works


i dont know if this is related or known not to work, but i found the "skip not supported yet" exception.
This is a little confusing to me as the next test is just like the former one, without the last variable


h3. test2 with all variables filled
{noformat} 
public List<foo2> test2(){
	
	return new List<foo2> (){
		new foo2(){
			Test1="s",
			Test2=2
		}
	};
}	
{noformat}
->
{noformat} 
[1,"test2",2,0,{"0":{"lst":["rec",1,{"1":{"str":"s"},"2":{"i32":2}}]}}]
{noformat}
->
jQ: "skip not supported yet"
eval(): works


...which is exactly the same result as if i take test1 function and dont set the last variable

h3. test1 with only the first 2 variables set
{noformat}
public List<foo> test1(){
	return new List<foo> (){
		new foo(){
			Test1="s",
			Test2=22
		}
	};
}
{noformat}
->
{noformat}
[1,"test1",2,0,{"0":{"lst":["rec",1,{"1":{"str":"s"},"2":{"i32":22}}]}}]
{noformat}
->
jQ: "skip not supported yet"
eval(): works


I could try and include it into the test suite, but it would take some time as i am currently fed up with bugs :-)

[EDIT] copy-pasted a wrong line

      was (Author: nilshu):
    I am using c# as server. I have made some tests:

{noformat}
struct foo{
  1: string test1,
  2: i32 test2,
  3: i32 test3,
}

struct foo2{
  1: string test1,
  2: i32 test2
}

service tester{
  list<foo> test1()
  list<foo2> test2()
}
{noformat}

h3. test1 with all variables set
{noformat}
public List<foo> test1(){
	return new List<foo> (){
		new foo(){
			Test1="s",
			Test2=2,
			Test3=3
		}
	};
}
{noformat}
->
{noformat}
[1,"test1",2,0,{"0":{"lst":["rec",1,{"1":{"str":"s"},"2":{"i32":2},"3":{"i32":3}}]}}]
{noformat}
->
jQ: "this.rstack[this.rstack.length - 1] is undefined" / thrift.js 662
eval(): works


i dont know if this is related or known not to work, but i found the "skip not supported yet" exception.
This is a little confusing to me as the next test is just like the former one, without the last variable


h3. test2 with all variables filled
{noformat} 
public List<foo2> test2(){
	
	return new List<foo2> (){
		new foo2(){
			Test1="s",
			Test2=2
		}
	};
}	
{noformat}
->
{noformat} 
[1,"test2",2,0,{"0":{"lst":["rec",1,{"1":{"str":"s"},"2":{"i32":2}}]}}]
{noformat}
->
jQ: "skip not supported yet"
eval(): works


...which is exactly the same result as if i take test1 function and dont set the last variable

h3. test1 with only the first 2 variables set
{noformat}
public List<foo> test1(){
	return new List<foo> (){
		new foo(){
			Test1="s",
			Test2=22
		}
	};
}
{noformat}
->
{noformat}
[1,"test1",2,0,{"0":{"lst":["rec",1,{"1":{"str":"s"},"2":{"i32":2}}]}}]
{noformat}
->
jQ: "skip not supported yet"
eval(): works


I could try and include it into the test suite, but it would take some time as i am currently fed up with bugs :-)
  
> List Deserialization with jQuery doesnt work
> --------------------------------------------
>
>                 Key: THRIFT-1150
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1150
>             Project: Thrift
>          Issue Type: Bug
>          Components: JavaScript - Library
>    Affects Versions: 0.6.1
>            Reporter: Nils Hügelmann
>
> the following encoded data is properly processed when eval is used, but not when jQuery.parseJSON is active. (thrift.js line ~ 580)
> {noformat} 
> [1,"Info",2,0,{"0":{"rec":{"1":{"str":"de1"},"2":{"lst":["rec",1,{"1":{"str":"dev"},"2":{"str":"78.46.113.59"},"3":{"i32":2080},"4":{"i32":1},"5":{"i32":0},"6":{"str":"de"}}]},"4":{"rec":{"1":{"str":"127.0.0.1"},"2":{"str":"--"}}}}}}]
> {noformat}
> thrift definition is
> {noformat}
> struct Info{
>   1: string defaultGateway,
>   2: list<Gateway> gateways,
>   3: optional string showURL,
>   4: ExternalInfo externalInfo
> }
> {noformat}
> Error message is
> TypeError: this.rstack[this.rstack.length - 1] is undefined
> (thrift.js Line 662)
> This may be related to https://issues.apache.org/jira/browse/THRIFT-815 ??

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira