Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject toString() calls on arrays #118

Closed
cushon opened this issue Oct 31, 2014 · 1 comment
Closed

Reject toString() calls on arrays #118

cushon opened this issue Oct 31, 2014 · 1 comment

Comments

@cushon
Copy link
Collaborator

cushon commented Oct 31, 2014

Original issue created by lowasser@google.com on 2013-04-10 at 09:28 PM


I just encountered in real Google code the expression

   md5.digest(string.getBytes())
          .toString();

...which would output something like "[B@23fc4bec", which has no relationship at all to the hash of the string.

In general, you always want to use Arrays.toString instead of array.toString(), though this particular user might have preferred e.g. hex encoding or the like.

@cushon
Copy link
Collaborator Author

cushon commented Oct 31, 2014

Original comment posted by lowasser@google.com on 2013-04-13 at 07:29 PM


(No comment entered for this change.)


Status: Duplicate
Merged Into: #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant