-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Conversation
There was a problem hiding this 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!
core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
Outdated
Show resolved
Hide resolved
56ac2af
to
93ea2e7
Compare
core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/shiro/realm/text/TextConfigurationRealmTest.java
Outdated
Show resolved
Hide resolved
} catch (Exception e) { | ||
if (log.isWarnEnabled()) { | ||
String msg = "Unable to fetch next line, Scanner stream corrupted."; | ||
log.warn(msg, e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} 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.
There was a problem hiding this comment.
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.
@pitjazz actually, reopened the PR with a suggestion, as I think that is what you are trying to resolve |
4617a31
to
cfa2883
Compare
There was a problem hiding this 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)
Commit message fixed. |
Thanks @pitjazz |
Following this checklist to help us incorporate your contribution quickly and easily:
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.
[SHIRO-XXX] - Fixes bug in SessionManager
,where you replace
SHIRO-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the commit message.
mvn clean install apache-rat:check
to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.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.