Ensure auto close of HTMLStripCharFilter in HtmlStripProcessor
The HtmlStripProcessor did not use a try-with resources block to ensure that the used HTMLStripCharFilter is closed.
This commit is contained in:
parent
d53c941c41
commit
2061652988
|
@ -41,13 +41,11 @@ public final class HtmlStripProcessor extends AbstractStringProcessor<String> {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLStripCharFilter filter = new HTMLStripCharFilter(new StringReader(value));
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
int ch;
|
try (HTMLStripCharFilter filter = new HTMLStripCharFilter(new StringReader(value))) {
|
||||||
try {
|
int ch;
|
||||||
while ((ch = filter.read()) != -1) {
|
while ((ch = filter.read()) != -1) {
|
||||||
builder.append((char)ch);
|
builder.append((char) ch);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchException(e);
|
throw new ElasticsearchException(e);
|
||||||
|
|
Loading…
Reference in New Issue