mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Made some temporary changes to make throwing ReaderExceptions more efficient. Long term, we need to delete this class and change the decoders to return errors instead of throwing.
git-svn-id: https://zxing.googlecode.com/svn/trunk@669 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
e6e3472471
commit
c4a28fa4a7
|
@ -23,10 +23,24 @@ package com.google.zxing;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class ReaderException extends Exception {
|
||||
|
||||
// TODO: Currently we throw up to 400 ReaderExceptions while scanning a single 240x240 image before
|
||||
// rejecting it. This involves a lot of overhead and memory allocation, and affects both performance
|
||||
// and latency on continuous scan clients. In the future, we should change all the decoders not to
|
||||
// throw exceptions for routine events, like not finding a barcode on a given row. Instead, we
|
||||
// should return error codes back to the callers, and simply delete this class. In the mean time, I
|
||||
// have altered this class to be as lightweight as possible, by ignoring the exception string, and
|
||||
// by disabling the generation of stack traces, which is especially time consuming. These are just
|
||||
// temporary measures, pending the big cleanup.
|
||||
public final class ReaderException extends java.lang.Throwable {
|
||||
|
||||
public ReaderException(String message) {
|
||||
super(message);
|
||||
// Do not pass message to Throwable, let it get optimized out
|
||||
}
|
||||
|
||||
// Prevent stack traces from being taken
|
||||
public Throwable fillInStackTrace() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue