File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
spring-shell-core/src/main/java/org/springframework/shell/jline Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2017 the original author or authors.
2+ * Copyright 2017-2025 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -63,17 +63,11 @@ public Input readInput() {
6363 } catch (IOException e ) {
6464 throw new RuntimeException (e );
6565 }
66- if (line == null ) {
66+ if (line == null || isComment ( line ) ) {
6767 return null ;
6868 } else {
69- // gh-277: if it's a commented line then skip as it is equal to NO_INPUT
70- ParsedLine parsedLine ;
71- if (isCommentedLine (line )) {
72- parsedLine = parser .parse ("" , -1 , Parser .ParseContext .COMPLETE );
73- } else {
74- parsedLine = parser .parse (sb .toString (), sb .toString ().length ());
75- }
76- return new ParsedLineInput (parsedLine );
69+ ParsedLine parsedLine = parser .parse (sb .toString (), sb .toString ().length ());
70+ return new ParsedLineInput (parsedLine );
7771 }
7872 }
7973
@@ -82,7 +76,7 @@ public void close() throws IOException {
8276 reader .close ();
8377 }
8478
85- private boolean isCommentedLine (String line ) {
79+ private boolean isComment (String line ) {
8680 return line .matches ("\\ s*//.*" );
8781 }
8882}
You can’t perform that action at this time.
0 commit comments