mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Some small improvements in error handling based on exceptions observed at zxing.org
git-svn-id: https://zxing.googlecode.com/svn/trunk@538 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
dbc1eebc49
commit
91b0ef1622
|
@ -74,6 +74,9 @@ public final class Detector {
|
|||
FinderPattern bottomLeft = info.getBottomLeft();
|
||||
|
||||
float moduleSize = calculateModuleSize(topLeft, topRight, bottomLeft);
|
||||
if (moduleSize < 1.0f) {
|
||||
throw new ReaderException("Module size too small");
|
||||
}
|
||||
int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize);
|
||||
Version provisionalVersion = Version.getProvisionalVersionForDimension(dimension);
|
||||
int modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7;
|
||||
|
|
|
@ -58,6 +58,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.SocketException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.UnknownHostException;
|
||||
|
@ -160,6 +161,14 @@ public final class DecodeServlet extends HttpServlet {
|
|||
} finally {
|
||||
is.close();
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// Thrown if hostname is bad or null
|
||||
getRequest.abort();
|
||||
response.sendRedirect("badurl.jspx");
|
||||
} catch (SocketException se) {
|
||||
// Thrown if hostname is bad or null
|
||||
getRequest.abort();
|
||||
response.sendRedirect("badurl.jspx");
|
||||
} catch (HttpException he) {
|
||||
getRequest.abort();
|
||||
response.sendRedirect("badurl.jspx");
|
||||
|
|
Loading…
Reference in a new issue