Convert asserts to exceptions where the conditions could be false in a correct, bug...
[zxing.git] / androidtest / src / com / google / zxing / client / androidtest / SaveThread.java
index d1093a4..698d6ef 100755 (executable)
@@ -48,6 +48,7 @@ final class SaveThread extends Thread {
   public void run() {
     Looper.prepare();
     mHandler = new Handler() {
+      @Override
       public void handleMessage(Message message) {
         switch (message.what) {
           case R.id.save:
@@ -66,8 +67,9 @@ final class SaveThread extends Thread {
   private void save(byte[] data, int width, int height) {
     int framingWidth = mFramingRect.width();
     int framingHeight = mFramingRect.height();
-    assert (framingWidth <= width);
-    assert (framingHeight <= height);
+    if (framingWidth > width || framingHeight > height) {
+      throw new IllegalArgumentException();
+    }
 
     int leftOffset = mFramingRect.left;
     int topOffset = mFramingRect.top;
@@ -101,7 +103,7 @@ final class SaveThread extends Thread {
     message.sendToTarget();
   }
 
-  private OutputStream getNewPhotoOutputStream() {
+  private static OutputStream getNewPhotoOutputStream() {
     File sdcard = new File("/sdcard");
     if (sdcard.exists()) {
       File barcodes = new File(sdcard, "barcodes");