You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Nathan Marz (JIRA)" <ji...@apache.org> on 2008/10/15 23:16:44 UTC
[jira] Created: (THRIFT-172) Improve printing of "binary"
Improve printing of "binary"
----------------------------
Key: THRIFT-172
URL: https://issues.apache.org/jira/browse/THRIFT-172
Project: Thrift
Issue Type: Improvement
Components: Compiler (Java)
Reporter: Nathan Marz
Priority: Minor
RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-172) Improve printing of "binary"
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646959#action_12646959 ]
Bryan Duxbury commented on THRIFT-172:
--------------------------------------
This is a nice improvement.
I think there might be a slight bug in terms of printing some bytes. In Java, bytes are signed, so FF as a byte is a negative number. This is probably counter to what most people would like to see printed.
If you bitwise-and the byte with 0xFF first, it'll get converted to an unsigned integer. Then, toHexString will produce what we're expecting to get.
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Bryan Duxbury
> Priority: Minor
> Attachments: thrift-172-v2.patch, thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-172) Improve printing of "binary"
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640044#action_12640044 ]
Bryan Duxbury commented on THRIFT-172:
--------------------------------------
I think that it would of course be hex. In fact, the above example is hex.
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-172) Improve printing of "binary"
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639969#action_12639969 ]
Bryan Duxbury commented on THRIFT-172:
--------------------------------------
I like this idea. You do run the risk of printing out large byte arrays here, which probably isn't what you're going for. Maybe we could have a default upper bound of something like 128 bytes and then truncate with "..." afterward?
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-172) Improve printing of "binary"
Posted by "Michael Greene (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639978#action_12639978 ]
Michael Greene commented on THRIFT-172:
---------------------------------------
Wouldn't hex be a little more reasonable, particularly for large byte arrays?
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-172) Improve printing of "binary"
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury updated THRIFT-172:
---------------------------------
Attachment: thrift-172.patch
Here's a pretty provisional patch for this functionality.
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Bryan Duxbury
> Priority: Minor
> Attachments: thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (THRIFT-172) Improve printing of "binary"
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury reassigned THRIFT-172:
------------------------------------
Assignee: Piotr Kozikowski (was: Bryan Duxbury)
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-172-v2.patch, thrift-172-v3.patch, thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-172) Improve printing of "binary"
Posted by "Piotr Kozikowski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Piotr Kozikowski updated THRIFT-172:
------------------------------------
Attachment: thrift-172-v2.patch
Here is a refined version of you patch. Previously the value
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
would print as
1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Bryan Duxbury
> Priority: Minor
> Attachments: thrift-172-v2.patch, thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (THRIFT-172) Improve printing of "binary"
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury reassigned THRIFT-172:
------------------------------------
Assignee: Bryan Duxbury
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Bryan Duxbury
> Priority: Minor
> Attachments: thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-172) Improve printing of "binary"
Posted by "Piotr Kozikowski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Piotr Kozikowski updated THRIFT-172:
------------------------------------
Attachment: thrift-172-v3.patch
Nice catch. Actually Integer.toHexString() already does the conversion, but to four bytes instead of just one, so for instance the value 255 (-1) gets converted to FFFFFFFF, the value -100 to FFFFFF9C, and so on. All I had to do was to get rid of the first six characters and just keep the last two.
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Bryan Duxbury
> Priority: Minor
> Attachments: thrift-172-v2.patch, thrift-172-v3.patch, thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-172) Improve printing of "binary"
Posted by "Nathan Marz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639973#action_12639973 ]
Nathan Marz commented on THRIFT-172:
------------------------------------
That sounds like a good approach.
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (THRIFT-172) Improve printing of "binary"
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Reiss resolved THRIFT-172.
--------------------------------
Resolution: Fixed
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-172-v2.patch, thrift-172-v3.patch, thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-172) Improve printing of "binary"
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury updated THRIFT-172:
---------------------------------
Patch Info: [Patch Available]
I've reviewed this patch, and I think it should be committed. Can a committer take a look?
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-172-v2.patch, thrift-172-v3.patch, thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (THRIFT-172) Improve printing of
"binary"
Posted by "Piotr Kozikowski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646937#action_12646937 ]
pkozikow edited comment on THRIFT-172 at 11/12/08 8:13 AM:
-------------------------------------------------------------------
Here is a refined version of your patch. Previously the value
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
would print as
1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
was (Author: pkozikow):
Here is a refined version of you patch. Previously the value
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
would print as
1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
> Improve printing of "binary"
> ----------------------------
>
> Key: THRIFT-172
> URL: https://issues.apache.org/jira/browse/THRIFT-172
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Bryan Duxbury
> Priority: Minor
> Attachments: thrift-172-v2.patch, thrift-172.patch
>
>
> RIght now, binary values print as "[B@d6f628)", which provides no information. It would be better if binary values printed like "'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.