|
1 | 1 | /* |
2 | | - * Copyright 2017-2023 the original author or authors. |
| 2 | + * Copyright 2017-2021 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -125,26 +125,23 @@ else if (!isEscapeChar(line, i)) { |
125 | 125 | } |
126 | 126 | } |
127 | 127 |
|
128 | | - if (current.length() > 0 || (line != null && cursor == line.length())) { |
129 | | - if (current.length() > 0) { |
130 | | - words.add(current.toString()); |
131 | | - } |
| 128 | + if (current.length() > 0 || cursor == line.length()) { |
| 129 | + words.add(current.toString()); |
132 | 130 | } |
133 | 131 |
|
134 | | - if (line != null && cursor == line.length() && words.size() > 0) { |
| 132 | + if (cursor == line.length()) { |
135 | 133 | wordIndex = words.size() - 1; |
136 | 134 | wordCursor = words.get(words.size() - 1).length(); |
137 | 135 | } |
138 | 136 |
|
139 | | - if (eofOnEscapedNewLine && (line != null && isEscapeChar(line, line.length() - 1))) { |
| 137 | + if (eofOnEscapedNewLine && isEscapeChar(line, line.length() - 1)) { |
140 | 138 | throw new EOFError(-1, -1, "Escaped new line", "newline"); |
141 | 139 | } |
142 | 140 | if (eofOnUnclosedQuote && quoteStart >= 0 && context != ParseContext.COMPLETE) { |
143 | | - throw new EOFError(-1, -1, "Missing closing quote", |
144 | | - (line != null && line.charAt(quoteStart) == '\'') ? "quote" : "dquote"); |
| 141 | + throw new EOFError(-1, -1, "Missing closing quote", line.charAt(quoteStart) == '\'' ? "quote" : "dquote"); |
145 | 142 | } |
146 | 143 |
|
147 | | - String openingQuote = (quoteStart >= 0 && line != null) ? line.substring(quoteStart, quoteStart + 1) : null; |
| 144 | + String openingQuote = quoteStart >= 0 ? line.substring(quoteStart, quoteStart + 1) : null; |
148 | 145 | return wrap(new ExtendedArgumentList(line, words, wordIndex, wordCursor, cursor, openingQuote)); |
149 | 146 | } |
150 | 147 |
|
|
0 commit comments