Closing ByteArrayInputStream in cz.jirutka.rsql.parser.RSQLParser.class
Rumpelshtinskiy opened this issue · 1 comments
Rumpelshtinskiy commented
v.2.1.0
I can't find where closes a ByteArrayInputStream, that opens in cz.jirutka.rsql.parser.RSQLParser.class on 116 line. I have checked the stream in generated Parser class, but not found. I'm afraid that it not closes.
/**
* Parses the RSQL expression and returns AST.
*
* @param query The query expression to parse.
* @return A root of the parsed AST.
*
* @throws RSQLParserException If some exception occurred during parsing, i.e. the
* {@code query} is syntactically invalid.
* @throws IllegalArgumentException If the {@code query} is <tt>null</tt>.
*/
public Node parse(String query) throws RSQLParserException {
if (query == null) {
throw new IllegalArgumentException("query must not be null");
}
--> InputStream is = new ByteArrayInputStream(query.getBytes(ENCODING));
Parser parser = new Parser(is, ENCODING.name(), nodesFactory);
try {
return parser.Input();
} catch (Exception | TokenMgrError ex) {
throw new RSQLParserException(ex);
}
}
qclucky7 commented
ByteArrayOutputStream read it in memory, It will be collected by the garbage collector