Untangle try-catch a bit in servlet, to properly catch 404 errors

This commit is contained in:
Sean Owen 2014-02-08 15:58:34 -05:00
parent 937d087365
commit 7f300ce09a

View file

@ -204,8 +204,6 @@ public final class DecodeServlet extends HttpServlet {
connection.setRequestProperty(HttpHeaders.USER_AGENT, "zxing.org"); connection.setRequestProperty(HttpHeaders.USER_AGENT, "zxing.org");
connection.setRequestProperty(HttpHeaders.CONNECTION, "close"); connection.setRequestProperty(HttpHeaders.CONNECTION, "close");
try {
try { try {
connection.connect(); connection.connect();
} catch (IOException ioe) { } catch (IOException ioe) {
@ -234,15 +232,12 @@ public final class DecodeServlet extends HttpServlet {
log.info("Decoding " + imageURL); log.info("Decoding " + imageURL);
processStream(is, request, response); processStream(is, request, response);
} catch (IOException ioe) {
log.info(ioe.toString());
response.sendRedirect("badurl.jspx");
} finally { } finally {
consumeRemainder(is); consumeRemainder(is);
} }
} } catch (IOException ioe) {
log.info(ioe.toString());
response.sendRedirect("badurl.jspx");
} finally { } finally {
connection.disconnect(); connection.disconnect();
} }