fix #534 : check byte size for bom

This commit is contained in:
Shinsuke Sugaya 2016-06-09 17:27:15 +09:00
parent b739e7d538
commit 43b09de15f

View file

@ -101,8 +101,8 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
try (final BufferedInputStream bis = new BufferedInputStream(responseData.getResponseBody())) {
final byte[] bomBytes = new byte[UTF8_BOM_SIZE];
bis.mark(UTF8_BOM_SIZE);
bis.read(bomBytes);
if (!isUtf8BomBytes(bomBytes)) {
final int size = bis.read(bomBytes);
if (size < 3 || !isUtf8BomBytes(bomBytes)) {
bis.reset();
}
final InputSource is = new InputSource(bis);