You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Henrique Mendonca (JIRA)" <ji...@apache.org> on 2011/06/09 16:01:59 UTC

[jira] [Created] (THRIFT-1203) Java server returns JSON map items in the wrong order

Java server returns JSON map items in the wrong order
-----------------------------------------------------

                 Key: THRIFT-1203
                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
             Project: Thrift
          Issue Type: Bug
          Components: Java - Compiler, Java - Library
    Affects Versions: 0.6, 0.7
            Reporter: Henrique Mendonca
            Priority: Minor


This is a old bug I have forgotten to register.
lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.

The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}

To run the server:
thrift-trunk/lib/java$ ant compile-test
thrift-trunk/lib/js/test$ ant testserver
and go to http://localhost:8088/test/test.html

Java test server console output:
[java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
[java] testMap({{8=88, 9=99, 7=77}})
[java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]

It's minor but it would be nice if any Java developer could have a look on it.
Thanks a lot.

ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Bill Dortch (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046960#comment-13046960 ] 

Bill Dortch commented on THRIFT-1203:
-------------------------------------

A TreeMap would not preserve insertion order, or the order in which entries appeared in the original JSON, only the natural ordering of the keys, which may or may not be the same thing.  A LinkedHashMap preserves insertion order. However, there is no reason to do this. JSON objects, like most map-like data structures, are unordered.  As the definition at http://json.org states, "An object is an unordered set of name/value pairs." It is an error for a client, including a unit test client, to expect the entries of a JSON object to appear in a particular order, just as it would be an error to expect the presence or absence of whitespace, which is not significant.  A unit test based on comparison to a particular string representation of a JSON object is inherently flawed, as would be an application that did the same.

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "T Jake Luciani (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046560#comment-13046560 ] 

T Jake Luciani commented on THRIFT-1203:
----------------------------------------

Why does the order of the json matter?

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046892#comment-13046892 ] 

Bryan Duxbury commented on THRIFT-1203:
---------------------------------------

Maps don't have ordering. When you are comparing the results, this can be annoying, but it's not incorrect. Furthermore, making them ordered identically has a nonzero cost, so I don't think we should do it.

I think we should close this ticket "won't fix", or we should rename it to focus on changing the test itself to be order-insensitive.

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046930#comment-13046930 ] 

Roger Meier commented on THRIFT-1203:
-------------------------------------

Yes, current implementation is order-insensitive.

http://wiki.apache.org/thrift/ThriftTypes mentions that Java uses HashMap

The spec at http://download.oracle.com/javase/1.4.2/docs/api/java/util/Map.html says
"The order of a map is defined as the order in which the iterators on the map's collection views return their elements. Some map implementations, like the TreeMap class, make specific *guarantees as to their order*; others, like the *HashMap* class, *do not*."

TreeMap vs. HashMap => What would it cost?

What about other languages?
Do they take care on the order of Map types?

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Resolved] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "T Jake Luciani (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

T Jake Luciani resolved THRIFT-1203.
------------------------------------

    Resolution: Won't Fix

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047135#comment-13047135 ] 

Roger Meier commented on THRIFT-1203:
-------------------------------------

I agree!
Just recognized, that Henrique added some test cases for that within THRIFT-1202
Let's have a look there.

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047004#comment-13047004 ] 

Roger Meier commented on THRIFT-1203:
-------------------------------------

Thanks all for clarification based on real facts and standards!
-Roger

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Ilya Maykov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047028#comment-13047028 ] 

Ilya Maykov commented on THRIFT-1203:
-------------------------------------

Shouldn't we open a related ticket to make the test order-insensitive?

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046940#comment-13046940 ] 

Bryan Duxbury commented on THRIFT-1203:
---------------------------------------

I think the ballpark is 3x longer for TreeMap vs HashMap.

However, even if they were the same performance, I'd be against the change. We would end up trying to guarantee that the ordering itself is the same between languages, which is, again, an exercise in helping a test pass. Not worth it.

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046836#comment-13046836 ] 

Roger Meier commented on THRIFT-1203:
-------------------------------------

We need the *same behavior* for all languages whenever possible to have *best interoperability* between the implementations.

Unit Tests should use ThriftTest.thrift and implement the same response for each test case, that's the idea behind THRIFT-847

Yes, I would like to see a patch for that bug.


> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "T Jake Luciani (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046932#comment-13046932 ] 

T Jake Luciani commented on THRIFT-1203:
----------------------------------------

If a parser is relying on the order of the map keys being the same then they are doing it wrong... maps are inherently unordered... I think making them strictly ordered is *less* portable across languages.

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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

[jira] [Commented] (THRIFT-1203) Java server returns JSON map items in the wrong order

Posted by "Henrique Mendonca (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047335#comment-13047335 ] 

Henrique Mendonca commented on THRIFT-1203:
-------------------------------------------

Fair enough, that makes sense.
The tests were comparing the order but I comment this out long ago to make them pass :)
and in this case we can safely remove the commented-out lines...

Anyway, thanks for taking the ticket in consideration.

> Java server returns JSON map items in the wrong order
> -----------------------------------------------------
>
>                 Key: THRIFT-1203
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1203
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.6, 0.7
>            Reporter: Henrique Mendonca
>            Priority: Minor
>              Labels: java, test, test-server
>
> This is a old bug I have forgotten to register.
> lib/js/test uses a Java server to run its unit tests, and by doing so I could see that there is a small problem on the Java JSON map decoder.
> The unit test "testMap" should echo a map<int,int> back to the client without changing it, but it's messing up with the items order, e.g. {7=77, 8=88, 9=99} returns {8=88, 9=99, 7=77}
> To run the server:
> thrift-trunk/lib/java$ ant compile-test
> thrift-trunk/lib/js/test$ ant testserver
> and go to http://localhost:8088/test/test.html
> Java test server console output:
> [java] Incoming content: [1,"testMap",1,0,{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}]
> [java] testMap({{8=88, 9=99, 7=77}})
> [java] Outgoing content: [1,"testMap",2,0,{"0":{"map":["i32","i32",3,{"8":88,"9":99,"7":77}]}}]
> It's minor but it would be nice if any Java developer could have a look on it.
> Thanks a lot.
> ps.: the same works with a cpp server

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