Updates from sanfordsquires to fix RS decoding for Datamatrix
[zxing.git] / core / src / com / google / zxing / ReaderException.java
1 /*
2  * Copyright 2007 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.google.zxing;
18
19 /**
20  * The general exception class throw when something goes wrong during decoding of a barcode.
21  * This includes, but is not limited to, failing checksums / error correction algorithms, being
22  * unable to locate finder timing patterns, and so on.
23  *
24  * @author srowen@google.com (Sean Owen)
25  */
26
27 // TODO: Currently we throw up to 400 ReaderExceptions while scanning a single 240x240 image before
28 // rejecting it. This involves a lot of overhead and memory allocation, and affects both performance
29 // and latency on continuous scan clients. In the future, we should change all the decoders not to
30 // throw exceptions for routine events, like not finding a barcode on a given row. Instead, we
31 // should return error codes back to the callers, and simply delete this class. In the mean time, I
32 // have altered this class to be as lightweight as possible, by ignoring the exception string, and
33 // by disabling the generation of stack traces, which is especially time consuming. These are just
34 // temporary measures, pending the big cleanup.
35 public final class ReaderException extends java.lang.Throwable {
36
37   public ReaderException(String message) {
38     // Do not pass message to Throwable, let it get optimized out
39   }
40
41   // Prevent stack traces from being taken
42   public Throwable fillInStackTrace() {
43     return null;
44   }
45
46 }