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

Bugfix, fixed Scanner issue #288

Merged
merged 1 commit into from
Apr 12, 2021
Merged

Conversation

pitjazz
Copy link
Contributor

@pitjazz pitjazz commented Mar 21, 2021

Following this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SHIRO-XXX] - Fixes bug in SessionManager,
    where you replace SHIRO-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install apache-rat:check to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If you have a group of commits related to the same change, please squash your commits into one and force push your branch using git rebase -i.

Trivial changes like typos do not require a JIRA issue (javadoc, comments...).
In this case, just format the pull request title like (DOC) - Add javadoc in SessionManager.

If this is your first contribution, you have to read the Contribution Guidelines

If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement
if you are unsure please ask on the developers list.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Copy link
Member

@bdemers bdemers left a comment

Choose a reason for hiding this comment

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

Thanks @pitjazz!

It's not clear what this PR fixes, can you update the PR title with a specific fix,
And add detail to the commit/PR description

Adding a test would be great too!

@pitjazz pitjazz force-pushed the bugfix-scanner branch 2 times, most recently from 56ac2af to 93ea2e7 Compare March 23, 2021 10:46
@bmarwell bmarwell self-requested a review March 23, 2021 16:09
@bdemers bdemers closed this Mar 23, 2021
@bdemers bdemers reopened this Mar 23, 2021
Comment on lines 222 to 226
} catch (Exception e) {
if (log.isWarnEnabled()) {
String msg = "Unable to fetch next line, Scanner stream corrupted.";
log.warn(msg, e);
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} catch (Exception e) {
if (log.isWarnEnabled()) {
String msg = "Unable to fetch next line, Scanner stream corrupted.";
log.warn(msg, e);
}
}

I'm guessing just removing the catch block should remove the sonar error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the catch block, updated the pull request. What I want to do is just close the scanner and catch is not needed for that.

I also removed the unit test. There is no need to test how scanner reads the nextLine, because reading of users and roles are already tested in TextConfigurationRealmTest. Perhaps closing the scanner could be tested, but IMHO it's not relevant.

@bdemers
Copy link
Member

bdemers commented Mar 23, 2021

@pitjazz actually, reopened the PR with a suggestion, as I think that is what you are trying to resolve

@pitjazz pitjazz force-pushed the bugfix-scanner branch 4 times, most recently from 4617a31 to cfa2883 Compare March 27, 2021 20:43
Copy link
Member

@bdemers bdemers left a comment

Choose a reason for hiding this comment

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

Code looks good now!

Can you fix the commit message (some of it is no longer valid)

@pitjazz
Copy link
Contributor Author

pitjazz commented Mar 29, 2021

Code looks good now!

Can you fix the commit message (some of it is no longer valid)

Commit message fixed.

@bdemers bdemers merged commit 7058994 into apache:master Apr 12, 2021
@bdemers
Copy link
Member

bdemers commented Apr 12, 2021

Thanks @pitjazz

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