Skip to content

CLOUDSTACK-8749: Add checks to prevent malformed/unexpected input - #735

Merged
asfgit merged 1 commit into
apache:masterfrom
shapeblue:kvm-linkbr-checks-master
Aug 26, 2015
Merged

CLOUDSTACK-8749: Add checks to prevent malformed/unexpected input#735
asfgit merged 1 commit into
apache:masterfrom
shapeblue:kvm-linkbr-checks-master

Conversation

@yadvr

Copy link
Copy Markdown
Member

Based on @jburwell's comment on PR #718

@asfbot

Copy link
Copy Markdown

cloudstack-pull-rats #379 SUCCESS
This pull request looks good

@asfbot

Copy link
Copy Markdown

cloudstack-pull-analysis #312 SUCCESS
This pull request looks good

@remibergsma

Copy link
Copy Markdown
Contributor

LGTM

@remibergsma

Copy link
Copy Markdown
Contributor

@jburwell can you review this please? Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jburwell

Copy link
Copy Markdown
Contributor

While it is a small nit and not expressly within the scope of this PR, could you fix the spelling mistake in the deleteExitingLinkLocalRouteTable name?

Based on @jburwell's comment on PR apache#718
This closesapache#735
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@yadvr
yadvrforce-pushed the kvm-linkbr-checks-master branch from 972117e to 7e455faCompareAugust 26, 2015 08:04
@yadvr

Copy link
Copy Markdown
MemberAuthor

renamed the method, s/deleteExitingLinkLocalRouteTable/deleteExistingLinkLocalRouteTable/g

@asfbot

Copy link
Copy Markdown

cloudstack-pull-rats #403 SUCCESS
This pull request looks good

@asfgit
asfgit merged commit 7e455fa into apache:masterAug 26, 2015
asfgit pushed a commit that referenced this pull request Aug 26, 2015
CLOUDSTACK-8749: Add checks to prevent malformed/unexpected inputBased on @jburwell's comment on PR #718
* pr/735:
CLOUDSTACK-8749: Add checks to prevent malformed/unexpected input
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@asfbot

Copy link
Copy Markdown

cloudstack-pull-analysis #336 UNSTABLE
Looks like there's a problem with this pull request

yadvr pushed a commit that referenced this pull request Jan 20, 2021
* fix message empty or undefined when switch project
* transalte message text
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@yadvr@asfbot@remibergsma@jburwell@asfgit