CLOUDSTACK-8749: Add checks to prevent malformed/unexpected input#735
CLOUDSTACK-8749: Add checks to prevent malformed/unexpected input#735asfgit merged 1 commit intoapache:masterfrom
Conversation
|
cloudstack-pull-rats #379 SUCCESS |
|
cloudstack-pull-analysis #312 SUCCESS |
|
LGTM |
|
@jburwell can you review this please? Thanks! |
There was a problem hiding this comment.
Reading through this block, it feels like lines 289-293 should be extracted to a private method:
static parseDevice(final String line) {
final String[] tokens = line.split( " ");
if (tokens != null && tokens.length < 2) {
return "";
}
final String device = tokens[2];
return Strings.isNullOrEmpty(device) : " " ? device;
}
The extraction of this method would not only shorten the deleteExitingLinkLocalLocalRoutetTable method, but clearly express the intent. It also allows a unit test to be written to verify that parsing works as expected for different types of input.
There was a problem hiding this comment.
With respect to this specific code, I would like do this the next time we do a round of refactoring, possibly factor such code to a util class that can be used as a general purpose line parsing static method and add unit tests. For now, at least the code takes care of malformed inputs.
|
While it is a small nit and not expressly within the scope of this PR, could you fix the spelling mistake in the |
Based on @jburwell's comment on PR apache#718 This closes apache#735 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
972117e to
7e455fa
Compare
|
renamed the method, s/deleteExitingLinkLocalRouteTable/deleteExistingLinkLocalRouteTable/g |
|
cloudstack-pull-rats #403 SUCCESS |
|
cloudstack-pull-analysis #336 UNSTABLE |
* fix message empty or undefined when switch project * transalte message text Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Based on @jburwell's comment on PR #718