You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by GitBox <gi...@apache.org> on 2021/03/22 19:57:30 UTC

[GitHub] [shiro] pitjazz commented on a change in pull request #288: Bugfix, fixed Scanner issue

pitjazz commented on a change in pull request #288:
URL: https://github.com/apache/shiro/pull/288#discussion_r599032388



##########
File path: core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
##########
@@ -211,11 +212,14 @@ 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());
-        }
-        return set;
+		try (Scanner scanner = new Scanner(s)) {
+			while (scanner.hasNextLine()) {
+				set.add(scanner.nextLine());
+			}
+		} catch (NoSuchElementException e) {
+			e.printStackTrace();
+		} 
+		return set;

Review comment:
       Link to Apache's SonarCloud: [the bug](https://sonarcloud.io/project/issues?id=apache_shiro&languages=java&open=AXTvO9kn3S_U1xqKcObL&resolved=false&severities=BLOCKER&types=BUG).




-- 
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:
users@infra.apache.org