Repository navigation
Fix findbugs encoding issue in VmwareStorageProcessor.java - #460
rsafonseca wants to merge 1 commit into
Conversation
Any encoding would do fine as it's just used to generate a UUID. Sticking with UTF-8 for consistency
|
cloudstack-pull-requests #458 SUCCESS |
There was a problem hiding this comment.
In other cases I used Charset.defaultCharset(). Is there a reason to explicitly use "UTF8"?
There was a problem hiding this comment.
@DaanHoogland
Unless you're getting platform specifc data, i think it's best to always stick to use the same charset, to avoid different values from being generated in different platforms whenever possible. Ideally, we should convert all data that comes into the application to a standard charset that supports internationalization such as UTF-8, and just use default platform charset where applicable, when consuming data from platform specific sources.
Using Charset.defaultCharset() will require an extra import and increase the overall size of the class, altough instantiating a String also has its own overhead, i believe it to be less so.. we can also remove string instantiation at runtime by defining a constant, which will also increase runtime efficiency.
Of course this is only my point of view, please comment if you feel otherwise :)
|
Here's an example of an instance where i also removed a Charset.defaultCharset() that was placed in the reading of a socket, where cloudstack controls both ends -> #400 And here's an example where i think it's most suited to use Charset.defaultCharset() , the output of a shell command: It's also possible to screw with the output of this from the system's side (although very unlikely), but this is the best approximation of 100% fail-proof of getting proper encoding of the input data. |
|
thanks, LGTM |
|
I shouldn't have:( exception uncought. Really curious why the pull request builder accepted this. |
|
my bad there.. will surround in try/catch block and update |
|
Daan Hoogland on dev@cloudstack.apache.org replies: |
|
please make it a seperate fix, not an update. I jumped the gun. On Tue, Jun 16, 2015 at 10:36 AM, Rafael da Fonseca <
Daan |
|
@DaanHoogland done! |
…ng would do fine as it's just used to generate a UUID. Sticking with UTF-8 for consistency Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com> This closes apache#460
…QL exception msg improvements (apache#460) * Don't send sql exception/query from dao to upper layer, log it and send only the error message * Updated charset to utf8mb4, for display_name column/user_vm table and job_result column/async_job table to support unicode chars & emojis * Added API arg validator for RFC compliance domain name, to validate VM's host name * Updated user resources name / display name column's charset to utf8mb4 * Check and update char set for affinity group name to utf8mb4, from the data migration in upgrade path * Updated backup offering name column charset to utf8mb4 * Added unit tests for vm host/domain name validation * Added smoke test to check resource name for vm, volume, service & disk offering, template, iso, account(first/lastname) * Updated resource annotation charset to utf8mb4 * Updated some resources description charset to utf8mb4
Any encoding would do fine as it's just used to generate a UUID. Sticking with UTF-8 for consistency