Revert another change that causes a whirr failure, fix rat warnings, and one more error on Android generated files

This commit is contained in:
Sean Owen 2015-05-15 16:23:18 +01:00
parent d272315f73
commit 8bae23a923
8 changed files with 36 additions and 27 deletions

View file

@ -35,10 +35,10 @@ public final class ChecksumException extends ReaderException {
}
public static ChecksumException getChecksumInstance() {
return IS_STACK_TRACE ? new ChecksumException() : INSTANCE;
return isStackTrace ? new ChecksumException() : INSTANCE;
}
public static ChecksumException getChecksumInstance(Throwable cause) {
return IS_STACK_TRACE ? new ChecksumException(cause) : INSTANCE;
return isStackTrace ? new ChecksumException(cause) : INSTANCE;
}
}

View file

@ -35,10 +35,10 @@ public final class FormatException extends ReaderException {
}
public static FormatException getFormatInstance() {
return IS_STACK_TRACE ? new FormatException() : INSTANCE;
return isStackTrace ? new FormatException() : INSTANCE;
}
public static FormatException getFormatInstance(Throwable cause) {
return IS_STACK_TRACE ? new FormatException(cause) : INSTANCE;
return isStackTrace ? new FormatException(cause) : INSTANCE;
}
}

View file

@ -26,7 +26,7 @@ package com.google.zxing;
public abstract class ReaderException extends Exception {
// 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;
ReaderException() {

View file

@ -426,6 +426,7 @@ public final class BitMatrix implements Cloneable {
* @param setString representation of a set bit
* @param unsetString representation of an unset bit
* @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

View file

@ -115,7 +115,7 @@ public final class DataMatrixWriter implements Writer {
for (int y = 0; y < symbolHeight; y++) {
// Fill the top edge with alternate 0 / 1
int matrixX;
if ((y % symbolInfo.getMatrixHeight()) == 0) {
if ((y % symbolInfo.matrixHeight) == 0) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, (x % 2) == 0);
@ -126,21 +126,21 @@ public final class DataMatrixWriter implements Writer {
matrixX = 0;
for (int x = 0; x < symbolWidth; x++) {
// Fill the right edge with full 1
if ((x % symbolInfo.getMatrixWidth()) == 0) {
if ((x % symbolInfo.matrixWidth) == 0) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrix.set(matrixX, matrixY, placement.getBit(x, y));
matrixX++;
// 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);
matrixX++;
}
}
matrixY++;
// Fill the bottom edge with full 1
if ((y % symbolInfo.getMatrixHeight()) == symbolInfo.getMatrixHeight() - 1) {
if ((y % symbolInfo.matrixHeight) == symbolInfo.matrixHeight - 1) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, true);

View file

@ -75,8 +75,8 @@ public class SymbolInfo {
private final boolean rectangular;
private final int dataCapacity;
private final int errorCodewords;
private final int matrixWidth;
private final int matrixHeight;
public final int matrixWidth;
public final int matrixHeight;
private final int dataRegions;
private final int rsBlockData;
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() {
return getHorizontalDataRegions() * matrixWidth;
}

View file

@ -29,29 +29,29 @@ public final class SymbolInfoTestCase extends Assert {
public void testSymbolInfo() {
SymbolInfo info = SymbolInfo.lookup(3);
assertEquals(5, info.getErrorCodewords());
assertEquals(8, info.getMatrixWidth());
assertEquals(8, info.getMatrixHeight());
assertEquals(8, info.matrixWidth);
assertEquals(8, info.matrixHeight);
assertEquals(10, info.getSymbolWidth());
assertEquals(10, info.getSymbolHeight());
info = SymbolInfo.lookup(3, SymbolShapeHint.FORCE_RECTANGLE);
assertEquals(7, info.getErrorCodewords());
assertEquals(16, info.getMatrixWidth());
assertEquals(6, info.getMatrixHeight());
assertEquals(16, info.matrixWidth);
assertEquals(6, info.matrixHeight);
assertEquals(18, info.getSymbolWidth());
assertEquals(8, info.getSymbolHeight());
info = SymbolInfo.lookup(9);
assertEquals(11, info.getErrorCodewords());
assertEquals(14, info.getMatrixWidth());
assertEquals(6, info.getMatrixHeight());
assertEquals(14, info.matrixWidth);
assertEquals(6, info.matrixHeight);
assertEquals(32, info.getSymbolWidth());
assertEquals(8, info.getSymbolHeight());
info = SymbolInfo.lookup(9, SymbolShapeHint.FORCE_SQUARE);
assertEquals(12, info.getErrorCodewords());
assertEquals(14, info.getMatrixWidth());
assertEquals(14, info.getMatrixHeight());
assertEquals(14, info.matrixWidth);
assertEquals(14, info.matrixHeight);
assertEquals(16, info.getSymbolWidth());
assertEquals(16, info.getSymbolHeight());

16
pom.xml
View file

@ -412,6 +412,8 @@
<version>2.15</version>
<configuration>
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
<!-- Android generated files -->
<excludes>**/R.java,**/BuildConfig.java</excludes>
</configuration>
<executions>
<execution>
@ -460,6 +462,20 @@
</goals>
</execution>
</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>
<groupId>org.codehaus.mojo</groupId>