diff --git a/android/src/com/google/zxing/client/android/CameraManager.java b/android/src/com/google/zxing/client/android/CameraManager.java index 756e1b033..4b6fd4e1e 100644 --- a/android/src/com/google/zxing/client/android/CameraManager.java +++ b/android/src/com/google/zxing/client/android/CameraManager.java @@ -275,7 +275,9 @@ final class CameraManager { int previewHeight = (int) (stillResolution.x * stillMultiplier * 1.5f); int previewWidth = previewHeight * screenResolution.x / screenResolution.y; previewWidth = ((previewWidth + 7) >> 3) << 3; - if (previewWidth > cameraResolution.x) previewWidth = cameraResolution.x; + if (previewWidth > cameraResolution.x) { + previewWidth = cameraResolution.x; + } previewHeight = previewWidth * screenResolution.y / screenResolution.x; previewResolution = new Point(previewWidth, previewHeight); Log.v(TAG, "previewWidth " + previewWidth + " previewHeight " + previewHeight); diff --git a/android/src/com/google/zxing/client/android/DecodeThread.java b/android/src/com/google/zxing/client/android/DecodeThread.java index e752a678b..7599a9221 100644 --- a/android/src/com/google/zxing/client/android/DecodeThread.java +++ b/android/src/com/google/zxing/client/android/DecodeThread.java @@ -214,9 +214,8 @@ final class DecodeThread extends Thread { return null; } - private String getNewPhotoName() { - Date now = new Date(); - return "capture" + now.getTime() + ".jpg"; + private static String getNewPhotoName() { + return "capture" + System.currentTimeMillis() + ".jpg"; } } diff --git a/bug/src/com/google/zxing/client/bug/app/BugBarcodeApp.java b/bug/src/com/google/zxing/client/bug/app/BugBarcodeApp.java index d017211a7..01d6d05a6 100644 --- a/bug/src/com/google/zxing/client/bug/app/BugBarcodeApp.java +++ b/bug/src/com/google/zxing/client/bug/app/BugBarcodeApp.java @@ -43,9 +43,9 @@ import java.io.IOException; */ public final class BugBarcodeApp implements IButtonEventListener, ImageObserver { - private ICameraDevice camera; - private ICameraModuleControl cameraControl; - private Frame frame; + private final ICameraDevice camera; + private final ICameraModuleControl cameraControl; + private final Frame frame; private Image image; private ImageCanvas imageCanvas; private Label barcodeLabel; diff --git a/core/src/com/google/zxing/common/GridSampler.java b/core/src/com/google/zxing/common/GridSampler.java index c99140c14..93a390050 100644 --- a/core/src/com/google/zxing/common/GridSampler.java +++ b/core/src/com/google/zxing/common/GridSampler.java @@ -34,7 +34,7 @@ import com.google.zxing.ReaderException; */ public abstract class GridSampler { - private static GridSampler gridSampler; + private static GridSampler gridSampler = null; /** * Sets the implementation of {@link GridSampler} used by the library. One global @@ -56,6 +56,8 @@ public abstract class GridSampler { * @return the current implementation of {@link GridSampler} */ public static GridSampler getInstance() { + // No real point in trying to make this thread-safe; + // doesn't matter if a second instance is created if (gridSampler == null) { gridSampler = new DefaultGridSampler(); } diff --git a/core/src/com/google/zxing/oned/AbstractUPCEANReader.java b/core/src/com/google/zxing/oned/AbstractUPCEANReader.java index 96df094be..f971a628e 100644 --- a/core/src/com/google/zxing/oned/AbstractUPCEANReader.java +++ b/core/src/com/google/zxing/oned/AbstractUPCEANReader.java @@ -141,7 +141,9 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements */ boolean checkChecksum(String s) throws ReaderException { int length = s.length(); - if (length == 0) return false; + if (length == 0) { + return false; + } int sum = 0; for (int i = length - 2; i >= 0; i -= 2) { diff --git a/zxingorg/src/com/google/zxing/web/DecodeEmailTask.java b/zxingorg/src/com/google/zxing/web/DecodeEmailTask.java index 08133d6df..fda4853bf 100644 --- a/zxingorg/src/com/google/zxing/web/DecodeEmailTask.java +++ b/zxingorg/src/com/google/zxing/web/DecodeEmailTask.java @@ -163,7 +163,7 @@ final class DecodeEmailTask extends TimerTask { } } - private void closeResources(Store store, Folder inbox) { + private static void closeResources(Store store, Folder inbox) { try { if (inbox != null) { inbox.close(true);