public final class QRCodeWriter implements Writer {
public final class QRCodeWriter implements Writer {
- public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width,
- int height) throws Exception {
+ public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height) {
return encode(contents, format, width, height, null);
}
return encode(contents, format, width, height, null);
}
- public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height,
- Hashtable hints) throws Exception {
+ public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height, Hashtable hints) {
if (contents == null || contents.length == 0) {
throw new IllegalArgumentException("Found empty contents");
if (contents == null || contents.length == 0) {
throw new IllegalArgumentException("Found empty contents");
if (Encoder.Encode(new ByteArray(contents), errorCorrectionLevel, code)) {
return renderResult(code, width, height);
} else {
if (Encoder.Encode(new ByteArray(contents), errorCorrectionLevel, code)) {
return renderResult(code, width, height);
} else {
- throw new IllegalStateException("Could not generate a QR Code");
+ // TODO need a "WriterException" or something
+ throw new RuntimeException("Could not generate a QR Code");
public class Debug {
public static void LOG_ERROR(String message) {
public class Debug {
public static void LOG_ERROR(String message) {
- throw new IllegalStateException(message);
+ // Can't use IllegalStateException unfortunately in J2ME
+ // TODO do something else with this anyway
+ throw new RuntimeException(message);
}
public static void LOG_INFO(String message) {
}
public static void LOG_INFO(String message) {
- throw new IllegalStateException(message);
+ throw new RuntimeException(message);
}
public static void DCHECK(boolean condition) {
if (!condition) {
}
public static void DCHECK(boolean condition) {
if (!condition) {
- throw new IllegalStateException();
+ throw new RuntimeException();