mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 03:37:34 -08:00
Better info logging in web app, and better clearing of buffers
This commit is contained in:
parent
1f14baf6f2
commit
ce072f02f9
|
@ -244,9 +244,8 @@ public final class DecodeServlet extends HttpServlet {
|
|||
|
||||
private static void consumeRemainder(InputStream is) {
|
||||
try {
|
||||
int available;
|
||||
while ((available = is.available()) > 0) {
|
||||
is.read(REMAINDER_BUFFER, 0, available); // don't care about value, or collision
|
||||
while (is.read(REMAINDER_BUFFER) > 0) {
|
||||
// don't care about value, or collision
|
||||
}
|
||||
} catch (IOException | IndexOutOfBoundsException ioe) {
|
||||
// sun.net.www.http.ChunkedInputStream.read is throwing IndexOutOfBoundsException
|
||||
|
@ -280,7 +279,7 @@ public final class DecodeServlet extends HttpServlet {
|
|||
log.info("File upload was not multipart");
|
||||
errorResponse(request, response, "badimage");
|
||||
} else {
|
||||
log.info("Decoding uploaded file");
|
||||
log.info("Decoding uploaded file " + fileUploadPart);
|
||||
try (InputStream is = fileUploadPart.getInputStream()) {
|
||||
processStream(is, request, response);
|
||||
}
|
||||
|
@ -378,10 +377,10 @@ public final class DecodeServlet extends HttpServlet {
|
|||
try {
|
||||
throw savedException == null ? NotFoundException.getNotFoundInstance() : savedException;
|
||||
} catch (FormatException | ChecksumException e) {
|
||||
log.info(e.getMessage());
|
||||
log.info(e.toString());
|
||||
errorResponse(request, response, "format");
|
||||
} catch (ReaderException e) { // Including NotFoundException
|
||||
log.info(e.getMessage());
|
||||
log.info(e.toString());
|
||||
errorResponse(request, response, "notfound");
|
||||
}
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue