mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Revert another change that causes a whirr failure, fix rat warnings, and one more error on Android generated files
This commit is contained in:
parent
d272315f73
commit
8bae23a923
|
@ -35,10 +35,10 @@ public final class ChecksumException extends ReaderException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChecksumException getChecksumInstance() {
|
public static ChecksumException getChecksumInstance() {
|
||||||
return IS_STACK_TRACE ? new ChecksumException() : INSTANCE;
|
return isStackTrace ? new ChecksumException() : INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChecksumException getChecksumInstance(Throwable cause) {
|
public static ChecksumException getChecksumInstance(Throwable cause) {
|
||||||
return IS_STACK_TRACE ? new ChecksumException(cause) : INSTANCE;
|
return isStackTrace ? new ChecksumException(cause) : INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,10 +35,10 @@ public final class FormatException extends ReaderException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FormatException getFormatInstance() {
|
public static FormatException getFormatInstance() {
|
||||||
return IS_STACK_TRACE ? new FormatException() : INSTANCE;
|
return isStackTrace ? new FormatException() : INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FormatException getFormatInstance(Throwable cause) {
|
public static FormatException getFormatInstance(Throwable cause) {
|
||||||
return IS_STACK_TRACE ? new FormatException(cause) : INSTANCE;
|
return isStackTrace ? new FormatException(cause) : INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,7 +26,7 @@ package com.google.zxing;
|
||||||
public abstract class ReaderException extends Exception {
|
public abstract class ReaderException extends Exception {
|
||||||
|
|
||||||
// disable stack traces when not running inside test units
|
// disable stack traces when not running inside test units
|
||||||
protected static final boolean IS_STACK_TRACE =
|
protected static final boolean isStackTrace =
|
||||||
System.getProperty("surefire.test.class.path") != null;
|
System.getProperty("surefire.test.class.path") != null;
|
||||||
|
|
||||||
ReaderException() {
|
ReaderException() {
|
||||||
|
|
|
@ -426,6 +426,7 @@ public final class BitMatrix implements Cloneable {
|
||||||
* @param setString representation of a set bit
|
* @param setString representation of a set bit
|
||||||
* @param unsetString representation of an unset bit
|
* @param unsetString representation of an unset bit
|
||||||
* @param lineSeparator newline character in string representation
|
* @param lineSeparator newline character in string representation
|
||||||
|
* @return string representation of entire matrix utilizing given strings and line separator
|
||||||
* @deprecated call {@link #toString(String,String)} only, which uses \n line separator always
|
* @deprecated call {@link #toString(String,String)} only, which uses \n line separator always
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -115,7 +115,7 @@ public final class DataMatrixWriter implements Writer {
|
||||||
for (int y = 0; y < symbolHeight; y++) {
|
for (int y = 0; y < symbolHeight; y++) {
|
||||||
// Fill the top edge with alternate 0 / 1
|
// Fill the top edge with alternate 0 / 1
|
||||||
int matrixX;
|
int matrixX;
|
||||||
if ((y % symbolInfo.getMatrixHeight()) == 0) {
|
if ((y % symbolInfo.matrixHeight) == 0) {
|
||||||
matrixX = 0;
|
matrixX = 0;
|
||||||
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
|
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
|
||||||
matrix.set(matrixX, matrixY, (x % 2) == 0);
|
matrix.set(matrixX, matrixY, (x % 2) == 0);
|
||||||
|
@ -126,21 +126,21 @@ public final class DataMatrixWriter implements Writer {
|
||||||
matrixX = 0;
|
matrixX = 0;
|
||||||
for (int x = 0; x < symbolWidth; x++) {
|
for (int x = 0; x < symbolWidth; x++) {
|
||||||
// Fill the right edge with full 1
|
// Fill the right edge with full 1
|
||||||
if ((x % symbolInfo.getMatrixWidth()) == 0) {
|
if ((x % symbolInfo.matrixWidth) == 0) {
|
||||||
matrix.set(matrixX, matrixY, true);
|
matrix.set(matrixX, matrixY, true);
|
||||||
matrixX++;
|
matrixX++;
|
||||||
}
|
}
|
||||||
matrix.set(matrixX, matrixY, placement.getBit(x, y));
|
matrix.set(matrixX, matrixY, placement.getBit(x, y));
|
||||||
matrixX++;
|
matrixX++;
|
||||||
// Fill the right edge with alternate 0 / 1
|
// Fill the right edge with alternate 0 / 1
|
||||||
if ((x % symbolInfo.getMatrixWidth()) == symbolInfo.getMatrixWidth() - 1) {
|
if ((x % symbolInfo.matrixWidth) == symbolInfo.matrixWidth - 1) {
|
||||||
matrix.set(matrixX, matrixY, (y % 2) == 0);
|
matrix.set(matrixX, matrixY, (y % 2) == 0);
|
||||||
matrixX++;
|
matrixX++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
matrixY++;
|
matrixY++;
|
||||||
// Fill the bottom edge with full 1
|
// Fill the bottom edge with full 1
|
||||||
if ((y % symbolInfo.getMatrixHeight()) == symbolInfo.getMatrixHeight() - 1) {
|
if ((y % symbolInfo.matrixHeight) == symbolInfo.matrixHeight - 1) {
|
||||||
matrixX = 0;
|
matrixX = 0;
|
||||||
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
|
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
|
||||||
matrix.set(matrixX, matrixY, true);
|
matrix.set(matrixX, matrixY, true);
|
||||||
|
|
|
@ -75,8 +75,8 @@ public class SymbolInfo {
|
||||||
private final boolean rectangular;
|
private final boolean rectangular;
|
||||||
private final int dataCapacity;
|
private final int dataCapacity;
|
||||||
private final int errorCodewords;
|
private final int errorCodewords;
|
||||||
private final int matrixWidth;
|
public final int matrixWidth;
|
||||||
private final int matrixHeight;
|
public final int matrixHeight;
|
||||||
private final int dataRegions;
|
private final int dataRegions;
|
||||||
private final int rsBlockData;
|
private final int rsBlockData;
|
||||||
private final int rsBlockError;
|
private final int rsBlockError;
|
||||||
|
@ -186,14 +186,6 @@ public class SymbolInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMatrixWidth() {
|
|
||||||
return matrixWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMatrixHeight() {
|
|
||||||
return matrixHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getSymbolDataWidth() {
|
public final int getSymbolDataWidth() {
|
||||||
return getHorizontalDataRegions() * matrixWidth;
|
return getHorizontalDataRegions() * matrixWidth;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,29 +29,29 @@ public final class SymbolInfoTestCase extends Assert {
|
||||||
public void testSymbolInfo() {
|
public void testSymbolInfo() {
|
||||||
SymbolInfo info = SymbolInfo.lookup(3);
|
SymbolInfo info = SymbolInfo.lookup(3);
|
||||||
assertEquals(5, info.getErrorCodewords());
|
assertEquals(5, info.getErrorCodewords());
|
||||||
assertEquals(8, info.getMatrixWidth());
|
assertEquals(8, info.matrixWidth);
|
||||||
assertEquals(8, info.getMatrixHeight());
|
assertEquals(8, info.matrixHeight);
|
||||||
assertEquals(10, info.getSymbolWidth());
|
assertEquals(10, info.getSymbolWidth());
|
||||||
assertEquals(10, info.getSymbolHeight());
|
assertEquals(10, info.getSymbolHeight());
|
||||||
|
|
||||||
info = SymbolInfo.lookup(3, SymbolShapeHint.FORCE_RECTANGLE);
|
info = SymbolInfo.lookup(3, SymbolShapeHint.FORCE_RECTANGLE);
|
||||||
assertEquals(7, info.getErrorCodewords());
|
assertEquals(7, info.getErrorCodewords());
|
||||||
assertEquals(16, info.getMatrixWidth());
|
assertEquals(16, info.matrixWidth);
|
||||||
assertEquals(6, info.getMatrixHeight());
|
assertEquals(6, info.matrixHeight);
|
||||||
assertEquals(18, info.getSymbolWidth());
|
assertEquals(18, info.getSymbolWidth());
|
||||||
assertEquals(8, info.getSymbolHeight());
|
assertEquals(8, info.getSymbolHeight());
|
||||||
|
|
||||||
info = SymbolInfo.lookup(9);
|
info = SymbolInfo.lookup(9);
|
||||||
assertEquals(11, info.getErrorCodewords());
|
assertEquals(11, info.getErrorCodewords());
|
||||||
assertEquals(14, info.getMatrixWidth());
|
assertEquals(14, info.matrixWidth);
|
||||||
assertEquals(6, info.getMatrixHeight());
|
assertEquals(6, info.matrixHeight);
|
||||||
assertEquals(32, info.getSymbolWidth());
|
assertEquals(32, info.getSymbolWidth());
|
||||||
assertEquals(8, info.getSymbolHeight());
|
assertEquals(8, info.getSymbolHeight());
|
||||||
|
|
||||||
info = SymbolInfo.lookup(9, SymbolShapeHint.FORCE_SQUARE);
|
info = SymbolInfo.lookup(9, SymbolShapeHint.FORCE_SQUARE);
|
||||||
assertEquals(12, info.getErrorCodewords());
|
assertEquals(12, info.getErrorCodewords());
|
||||||
assertEquals(14, info.getMatrixWidth());
|
assertEquals(14, info.matrixWidth);
|
||||||
assertEquals(14, info.getMatrixHeight());
|
assertEquals(14, info.matrixHeight);
|
||||||
assertEquals(16, info.getSymbolWidth());
|
assertEquals(16, info.getSymbolWidth());
|
||||||
assertEquals(16, info.getSymbolHeight());
|
assertEquals(16, info.getSymbolHeight());
|
||||||
|
|
||||||
|
|
16
pom.xml
16
pom.xml
|
@ -412,6 +412,8 @@
|
||||||
<version>2.15</version>
|
<version>2.15</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
|
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
|
||||||
|
<!-- Android generated files -->
|
||||||
|
<excludes>**/R.java,**/BuildConfig.java</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -460,6 +462,20 @@
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
<!-- workaround for Xerces warnings -->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.doxia</groupId>
|
||||||
|
<artifactId>doxia-core</artifactId>
|
||||||
|
<version>1.6</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>xerces</groupId>
|
||||||
|
<artifactId>xercesImpl</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
|
Loading…
Reference in a new issue