bdemers commented on a change in pull request #288:
URL: https://github.com/apache/shiro/pull/288#discussion_r599736092
##########
File path:
core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
##########
@@ -211,9 +215,15 @@ protected void processUserDefinitions(Map<String, String>
userDefs) {
protected static Set<String> toLines(String s) {
LinkedHashSet<String> set = new LinkedHashSet<String>();
- Scanner scanner = new Scanner(s);
- while (scanner.hasNextLine()) {
- set.add(scanner.nextLine());
+ try (Scanner scanner = new Scanner(s)) {
+ while (scanner.hasNextLine()) {
+ set.add(scanner.nextLine());
+ }
+ } catch (Exception e) {
+ if (log.isWarnEnabled()) {
+ String msg = "Unable to fetch next line, Scanner stream
corrupted.";
+ log.warn(msg, e);
+ }
Review comment:
```suggestion
}
```
I'm guessing just removing the catch block should remove the sonar error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]