Bump to 3.4.0. Require Java 8. Various code simplifications and plugin / dep updates

This commit is contained in:
Sean Owen 2019-05-13 18:44:57 -05:00
parent 39d50c1053
commit f1683e1f4f
43 changed files with 253 additions and 588 deletions

View file

@ -7,14 +7,11 @@ script:
- find $HOME/.m2/repository/com/google/zxing -name "*SNAPSHOT" -type d -delete
matrix:
include:
# Covers Java 7, Open JDK, and code coverage
- jdk: openjdk7
env: JACOCO=-Pjacoco
# Covers Java 8, Android apps
- jdk: openjdk8
env: ANDROID_HOME=$HOME/android-sdk-linux
env:
- JACOCO=-Pjacoco
- ANDROID_HOME=$HOME/android-sdk-linux
before_install: if [ ! -d $HOME/android-sdk-linux/platforms ]; then curl -s https://storage.googleapis.com/zxing-build/android-sdk-linux.tar.bz2 | bunzip2 | tar xf - -C $HOME; else ls -l $HOME/android-sdk-linux; fi
# Covers Java 9
- jdk: oraclejdk9
cache:
directories:

View file

@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>android-core</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
@ -31,7 +31,7 @@
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<name>ZXing Android Core</name>

View file

@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>android-integration</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
@ -31,7 +31,7 @@
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<name>ZXing Android Integration lib</name>

View file

@ -40,7 +40,7 @@ import android.util.Log;
* way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the
* project's source code.</p>
*
* <h2>Initiating a barcode scan</h2>
* <h1>Initiating a barcode scan</h1>
*
* <p>To integrate, create an instance of {@code IntentIntegrator} and call {@link #initiateScan()} and wait
* for the result in your app.</p>
@ -88,13 +88,13 @@ import android.util.Log;
* do so. The apps that are allowed to response can be set with {@link #setTargetApplications(List)}.
* For example, set to {@link #TARGET_BARCODE_SCANNER_ONLY} to only target the Barcode Scanner app itself.</p>
*
* <h2>Sharing text via barcode</h2>
* <h1>Sharing text via barcode</h1>
*
* <p>To share text, encoded as a QR Code on-screen, similarly, see {@link #shareText(CharSequence)}.</p>
*
* <p>Some code, particularly download integration, was contributed from the Anobiit application.</p>
*
* <h2>Enabling experimental barcode formats</h2>
* <h1>Enabling experimental barcode formats</h1>
*
* <p>Some formats are not enabled by default even when scanning with {@link #ALL_CODE_TYPES}, such as
* PDF417. Use {@link #initiateScan(Collection)} with
@ -151,7 +151,7 @@ public class IntentIntegrator {
private String buttonYes;
private String buttonNo;
private List<String> targetApplications;
private final Map<String,Object> moreExtras = new HashMap<String,Object>(3);
private final Map<String,Object> moreExtras = new HashMap<>(3);
/**
* @param activity {@link Activity} invoking the integration

View file

@ -39,7 +39,7 @@
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<build>

View file

@ -34,7 +34,7 @@ final class HistoryItemAdapter extends ArrayAdapter<HistoryItem> {
private final Context activity;
HistoryItemAdapter(Context activity) {
super(activity, R.layout.history_list_item, new ArrayList<HistoryItem>());
super(activity, R.layout.history_list_item, new ArrayList<>());
this.activity = activity;
}

View file

@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
@ -32,7 +32,7 @@
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<name>ZXing Core</name>
@ -66,7 +66,7 @@
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>3.5.0</version> <!-- 4.0.0 requires Java 8 -->
<version>4.2.0</version>
<executions>
<execution>
<goals>

View file

@ -112,13 +112,13 @@ public final class HybridBinarizer extends GlobalHistogramBinarizer {
if (yoffset > maxYOffset) {
yoffset = maxYOffset;
}
int top = cap(y, 2, subHeight - 3);
int top = cap(y, subHeight - 3);
for (int x = 0; x < subWidth; x++) {
int xoffset = x << BLOCK_SIZE_POWER;
if (xoffset > maxXOffset) {
xoffset = maxXOffset;
}
int left = cap(x, 2, subWidth - 3);
int left = cap(x, subWidth - 3);
int sum = 0;
for (int z = -2; z <= 2; z++) {
int[] blackRow = blackPoints[top + z];
@ -130,8 +130,8 @@ public final class HybridBinarizer extends GlobalHistogramBinarizer {
}
}
private static int cap(int value, int min, int max) {
return value < min ? min : value > max ? max : value;
private static int cap(int value, int max) {
return value < 2 ? 2 : value > max ? max : value;
}
/**

View file

@ -166,7 +166,7 @@ public final class StringUtils {
if (canBeUTF8 && (utf8bom || utf2BytesChars + utf3BytesChars + utf4BytesChars > 0)) {
return UTF8;
}
// Easy -- if assuming Shift_JIS or at least 3 valid consecutive not-ascii characters (and no evidence it can't be), done
// Easy -- if assuming Shift_JIS or >= 3 valid consecutive not-ascii characters (and no evidence it can't be), done
if (canBeShiftJIS && (ASSUME_SHIFT_JIS || sjisMaxKatakanaWordLength >= 3 || sjisMaxDoubleBytesWordLength >= 3)) {
return SHIFT_JIS;
}

View file

@ -87,13 +87,13 @@ public final class Detector {
return new DetectorResult(bits, new ResultPoint[]{topLeft, bottomLeft, bottomRight, topRight});
}
private ResultPoint shiftPoint(ResultPoint point, ResultPoint to, int div) {
private static ResultPoint shiftPoint(ResultPoint point, ResultPoint to, int div) {
float x = (to.getX() - point.getX()) / (div + 1);
float y = (to.getY() - point.getY()) / (div + 1);
return new ResultPoint(point.getX() + x, point.getY() + y);
}
private ResultPoint moveAway(ResultPoint point, float fromX, float fromY) {
private static ResultPoint moveAway(ResultPoint point, float fromX, float fromY) {
float x = point.getX();
float y = point.getY();

View file

@ -63,8 +63,8 @@ public class DefaultPlacement {
bits[row * numcols + col] = (byte) (bit ? 1 : 0);
}
private boolean hasBit(int col, int row) {
return bits[row * numcols + col] >= 0;
private boolean noBit(int col, int row) {
return bits[row * numcols + col] < 0;
}
public final void place() {
@ -73,7 +73,7 @@ public class DefaultPlacement {
int col = 0;
do {
/* repeatedly first check for one of the special corner cases, then... */
// repeatedly first check for one of the special corner cases, then...
if ((row == numrows) && (col == 0)) {
corner1(pos++);
}
@ -86,9 +86,9 @@ public class DefaultPlacement {
if ((row == numrows + 4) && (col == 2) && ((numcols % 8) == 0)) {
corner4(pos++);
}
/* sweep upward diagonally, inserting successive characters... */
// sweep upward diagonally, inserting successive characters...
do {
if ((row < numrows) && (col >= 0) && !hasBit(col, row)) {
if ((row < numrows) && (col >= 0) && noBit(col, row)) {
utah(row, col, pos++);
}
row -= 2;
@ -97,9 +97,9 @@ public class DefaultPlacement {
row++;
col += 3;
/* and then sweep downward diagonally, inserting successive characters, ... */
// and then sweep downward diagonally, inserting successive characters, ...
do {
if ((row >= 0) && (col < numcols) && !hasBit(col, row)) {
if ((row >= 0) && (col < numcols) && noBit(col, row)) {
utah(row, col, pos++);
}
row += 2;
@ -108,11 +108,11 @@ public class DefaultPlacement {
row += 3;
col++;
/* ...until the entire array is scanned */
// ...until the entire array is scanned
} while ((row < numrows) || (col < numcols));
/* Lastly, if the lower righthand corner is untouched, fill in fixed pattern */
if (!hasBit(numcols - 1, numrows - 1)) {
// Lastly, if the lower right-hand corner is untouched, fill in fixed pattern
if (noBit(numcols - 1, numrows - 1)) {
setBit(numcols - 1, numrows - 1, true);
setBit(numcols - 2, numrows - 2, true);
}

View file

@ -31,9 +31,9 @@ import com.google.zxing.multi.qrcode.detector.MultiDetector;
import com.google.zxing.qrcode.QRCodeReader;
import com.google.zxing.qrcode.decoder.QRCodeDecoderMetaData;
import java.io.ByteArrayOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Collections;
@ -97,20 +97,6 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
}
static List<Result> processStructuredAppend(List<Result> results) {
boolean hasSA = false;
// first, check, if there is at least on SA result in the list
for (Result result : results) {
if (result.getResultMetadata().containsKey(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE)) {
hasSA = true;
break;
}
}
if (!hasSA) {
return results;
}
// it is, second, split the lists and built a new result list
List<Result> newResults = new ArrayList<>();
List<Result> saResults = new ArrayList<>();
for (Result result : results) {
@ -120,45 +106,32 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
newResults.add(result);
}
}
if (saResults.isEmpty()) {
return results;
}
// sort and concatenate the SA list items
Collections.sort(saResults, new SAComparator());
StringBuilder concatedText = new StringBuilder();
int rawBytesLen = 0;
int byteSegmentLength = 0;
StringBuilder newText = new StringBuilder();
ByteArrayOutputStream newRawBytes = new ByteArrayOutputStream();
ByteArrayOutputStream newByteSegment = new ByteArrayOutputStream();
for (Result saResult : saResults) {
concatedText.append(saResult.getText());
rawBytesLen += saResult.getRawBytes().length;
if (saResult.getResultMetadata().containsKey(ResultMetadataType.BYTE_SEGMENTS)) {
@SuppressWarnings("unchecked")
Iterable<byte[]> byteSegments =
(Iterable<byte[]>) saResult.getResultMetadata().get(ResultMetadataType.BYTE_SEGMENTS);
newText.append(saResult.getText());
byte[] saBytes = saResult.getRawBytes();
newRawBytes.write(saBytes, 0, saBytes.length);
@SuppressWarnings("unchecked")
Iterable<byte[]> byteSegments =
(Iterable<byte[]>) saResult.getResultMetadata().get(ResultMetadataType.BYTE_SEGMENTS);
if (byteSegments != null) {
for (byte[] segment : byteSegments) {
byteSegmentLength += segment.length;
newByteSegment.write(segment, 0, segment.length);
}
}
}
byte[] newRawBytes = new byte[rawBytesLen];
byte[] newByteSegment = new byte[byteSegmentLength];
int newRawBytesIndex = 0;
int byteSegmentIndex = 0;
for (Result saResult : saResults) {
System.arraycopy(saResult.getRawBytes(), 0, newRawBytes, newRawBytesIndex, saResult.getRawBytes().length);
newRawBytesIndex += saResult.getRawBytes().length;
if (saResult.getResultMetadata().containsKey(ResultMetadataType.BYTE_SEGMENTS)) {
@SuppressWarnings("unchecked")
Iterable<byte[]> byteSegments =
(Iterable<byte[]>) saResult.getResultMetadata().get(ResultMetadataType.BYTE_SEGMENTS);
for (byte[] segment : byteSegments) {
System.arraycopy(segment, 0, newByteSegment, byteSegmentIndex, segment.length);
byteSegmentIndex += segment.length;
}
}
}
Result newResult = new Result(concatedText.toString(), newRawBytes, NO_POINTS, BarcodeFormat.QR_CODE);
if (byteSegmentLength > 0) {
Collection<byte[]> byteSegmentList = new ArrayList<>();
byteSegmentList.add(newByteSegment);
newResult.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegmentList);
Result newResult = new Result(newText.toString(), newRawBytes.toByteArray(), NO_POINTS, BarcodeFormat.QR_CODE);
if (newByteSegment.size() > 0) {
newResult.putMetadata(ResultMetadataType.BYTE_SEGMENTS, Collections.singletonList(newByteSegment.toByteArray()));
}
newResults.add(newResult);
return newResults;

View file

@ -49,6 +49,7 @@ import java.util.Map;
final class MultiFinderPatternFinder extends FinderPatternFinder {
private static final FinderPatternInfo[] EMPTY_RESULT_ARRAY = new FinderPatternInfo[0];
private static final FinderPattern[] EMPTY_FP_ARRAY = new FinderPattern[0];
private static final FinderPattern[][] EMPTY_FP_2D_ARRAY = new FinderPattern[0][];
// TODO MIN_MODULE_COUNT and MAX_MODULE_COUNT would be great hints to ask the user for
@ -85,15 +86,6 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
}
}
/**
* <p>Creates a finder that will search the image for three finder patterns.</p>
*
* @param image image to search
*/
MultiFinderPatternFinder(BitMatrix image) {
super(image);
}
MultiFinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback) {
super(image, resultPointCallback);
}
@ -117,13 +109,7 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
* Begin HE modifications to safely detect multiple codes of equal size
*/
if (size == 3) {
return new FinderPattern[][]{
new FinderPattern[]{
possibleCenters.get(0),
possibleCenters.get(1),
possibleCenters.get(2)
}
};
return new FinderPattern[][] { possibleCenters.toArray(EMPTY_FP_ARRAY) };
}
// Sort by estimated module size to speed up the upcoming checks

View file

@ -136,7 +136,8 @@ public final class Code39Writer extends OneDimensionalCodeWriter {
extendedContent.append('%');
extendedContent.append((char) ('P' + (character - 123)));
} else {
throw new IllegalArgumentException("Requested content contains a non-encodable character: '" + contents.charAt(i) + "'");
throw new IllegalArgumentException(
"Requested content contains a non-encodable character: '" + contents.charAt(i) + "'");
}
break;
}

View file

@ -98,7 +98,7 @@ public final class MultiFormatUPCEANReader extends OneDReader {
boolean canReturnUPCA = possibleFormats == null || possibleFormats.contains(BarcodeFormat.UPC_A);
if (ean13MayBeUPCA && canReturnUPCA) {
// Transfer the metdata across
// Transfer the metadata across
Result resultUPCA = new Result(result.getText().substring(1),
result.getRawBytes(),
result.getResultPoints(),

View file

@ -397,51 +397,56 @@ public final class RSS14Reader extends AbstractRSSReader {
}
incrementOdd = true;
incrementEven = true;
} else */ if (mismatch == 1) {
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementEven = true;
}
} else if (mismatch == -1) {
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementEven = true;
}
} else if (mismatch == 0) {
if (oddParityBad) {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
// Both bad
if (oddSum < evenSum) {
incrementOdd = true;
decrementEven = true;
} else {
} else */
switch (mismatch) {
case 1:
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementEven = true;
}
break;
case -1:
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementEven = true;
}
} else {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
break;
case 0:
if (oddParityBad) {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
// Both bad
if (oddSum < evenSum) {
incrementOdd = true;
decrementEven = true;
} else {
decrementOdd = true;
incrementEven = true;
}
} else {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
// Nothing to do!
}
// Nothing to do!
}
} else {
throw NotFoundException.getNotFoundInstance();
break;
default:
throw NotFoundException.getNotFoundInstance();
}
if (incrementOdd) {

View file

@ -21,48 +21,6 @@ public final class RSSUtils {
private RSSUtils() {}
/*
static int[] getRSSwidths(int val, int n, int elements, int maxWidth, boolean noNarrow) {
int[] widths = new int[elements];
int bar;
int narrowMask = 0;
for (bar = 0; bar < elements - 1; bar++) {
narrowMask |= 1 << bar;
int elmWidth = 1;
int subVal;
while (true) {
subVal = combins(n - elmWidth - 1, elements - bar - 2);
if (noNarrow && (narrowMask == 0) &&
(n - elmWidth - (elements - bar - 1) >= elements - bar - 1)) {
subVal -= combins(n - elmWidth - (elements - bar), elements - bar - 2);
}
if (elements - bar - 1 > 1) {
int lessVal = 0;
for (int mxwElement = n - elmWidth - (elements - bar - 2);
mxwElement > maxWidth;
mxwElement--) {
lessVal += combins(n - elmWidth - mxwElement - 1, elements - bar - 3);
}
subVal -= lessVal * (elements - 1 - bar);
} else if (n - elmWidth > maxWidth) {
subVal--;
}
val -= subVal;
if (val < 0) {
break;
}
elmWidth++;
narrowMask &= ~(1 << bar);
}
val += subVal;
n -= elmWidth;
widths[bar] = elmWidth;
}
widths[bar] = n;
return widths;
}
*/
public static int getRSSvalue(int[] widths, int maxWidth, boolean noNarrow) {
int n = 0;
for (int width : widths) {

View file

@ -60,7 +60,7 @@ final class ExpandedPair {
return this.finderPattern;
}
public boolean mustBeLast() {
boolean mustBeLast() {
return this.rightChar == null;
}

View file

@ -43,10 +43,6 @@ final class ExpandedRow {
return this.rowNumber;
}
boolean isReversed() {
return this.wasReversed;
}
boolean isEquivalent(List<ExpandedPair> otherPairs) {
return this.pairs.equals(otherPairs);
}

View file

@ -41,6 +41,7 @@ import com.google.zxing.oned.rss.RSSUtils;
import com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -197,7 +198,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
List<ExpandedPair> ps = null;
try {
ps = checkRows(new ArrayList<ExpandedRow>(), 0);
ps = checkRows(new ArrayList<>(), 0);
} catch (NotFoundException e) {
// OK
}
@ -220,21 +221,19 @@ public final class RSSExpandedReader extends AbstractRSSReader {
}
this.pairs.addAll(row.getPairs());
if (!isValidSequence(this.pairs)) {
continue;
}
if (isValidSequence(this.pairs)) {
if (checkChecksum()) {
return this.pairs;
}
if (checkChecksum()) {
return this.pairs;
}
List<ExpandedRow> rs = new ArrayList<>(collectedRows);
rs.add(row);
try {
// Recursion: try to add more rows
return checkRows(rs, i + 1);
} catch (NotFoundException e) {
// We failed, try the next candidate
List<ExpandedRow> rs = new ArrayList<>(collectedRows);
rs.add(row);
try {
// Recursion: try to add more rows
return checkRows(rs, i + 1);
} catch (NotFoundException e) {
// We failed, try the next candidate
}
}
}
@ -245,21 +244,19 @@ public final class RSSExpandedReader extends AbstractRSSReader {
// either complete or a prefix
private static boolean isValidSequence(List<ExpandedPair> pairs) {
for (int[] sequence : FINDER_PATTERN_SEQUENCES) {
if (pairs.size() > sequence.length) {
continue;
}
boolean stop = true;
for (int j = 0; j < pairs.size(); j++) {
if (pairs.get(j).getFinderPattern().getValue() != sequence[j]) {
stop = false;
break;
if (pairs.size() <= sequence.length) {
boolean stop = true;
for (int j = 0; j < pairs.size(); j++) {
if (pairs.get(j).getFinderPattern().getValue() != sequence[j]) {
stop = false;
break;
}
}
if (stop) {
return true;
}
}
if (stop) {
return true;
}
}
return false;
@ -287,7 +284,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
// it will prevent us from detecting the barcode.
// Try to merge partial rows
// Check whether the row is part of an allready detected row
// Check whether the row is part of an already detected row
if (isPartialRow(this.pairs, this.rows)) {
return;
}
@ -298,30 +295,22 @@ public final class RSSExpandedReader extends AbstractRSSReader {
}
// Remove all the rows that contains only specified pairs
private static void removePartialRows(List<ExpandedPair> pairs, List<ExpandedRow> rows) {
private static void removePartialRows(Collection<ExpandedPair> pairs, Collection<ExpandedRow> rows) {
for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) {
ExpandedRow r = iterator.next();
if (r.getPairs().size() == pairs.size()) {
continue;
}
boolean allFound = true;
for (ExpandedPair p : r.getPairs()) {
boolean found = false;
for (ExpandedPair pp : pairs) {
if (p.equals(pp)) {
found = true;
if (r.getPairs().size() != pairs.size()) {
boolean allFound = true;
for (ExpandedPair p : r.getPairs()) {
if (!pairs.contains(p)) {
allFound = false;
break;
}
}
if (!found) {
allFound = false;
break;
if (allFound) {
// 'pairs' contains all the pairs from the row 'r'
iterator.remove();
}
}
if (allFound) {
// 'pairs' contains all the pairs from the row 'r'
iterator.remove();
}
}
}
@ -650,13 +639,11 @@ public final class RSSExpandedReader extends AbstractRSSReader {
oddSum += oddCounts[i];
}
int evenChecksumPortion = 0;
//int evenSum = 0;
for (int i = evenCounts.length - 1; i >= 0; i--) {
if (isNotA1left(pattern, isOddPattern, leftChar)) {
int weight = WEIGHTS[weightRowNumber][2 * i + 1];
evenChecksumPortion += evenCounts[i] * weight;
}
//evenSum += evenCounts[i];
}
int checksumPortion = oddChecksumPortion + evenChecksumPortion;
@ -705,51 +692,55 @@ public final class RSSExpandedReader extends AbstractRSSReader {
int mismatch = oddSum + evenSum - numModules;
boolean oddParityBad = (oddSum & 0x01) == 1;
boolean evenParityBad = (evenSum & 0x01) == 0;
if (mismatch == 1) {
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementEven = true;
}
} else if (mismatch == -1) {
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementEven = true;
}
} else if (mismatch == 0) {
if (oddParityBad) {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
// Both bad
if (oddSum < evenSum) {
incrementOdd = true;
decrementEven = true;
} else {
switch (mismatch) {
case 1:
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
decrementEven = true;
}
break;
case -1:
if (oddParityBad) {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementOdd = true;
} else {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
incrementEven = true;
}
} else {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
break;
case 0:
if (oddParityBad) {
if (!evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
// Both bad
if (oddSum < evenSum) {
incrementOdd = true;
decrementEven = true;
} else {
decrementOdd = true;
incrementEven = true;
}
} else {
if (evenParityBad) {
throw NotFoundException.getNotFoundInstance();
}
// Nothing to do!
}
// Nothing to do!
}
} else {
throw NotFoundException.getNotFoundInstance();
break;
default:
throw NotFoundException.getNotFoundInstance();
}
if (incrementOdd) {

View file

@ -59,8 +59,8 @@ final class AI01393xDecoder extends AI01decoder {
buf.append(lastAIdigit);
buf.append(')');
int firstThreeDigits =
this.getGeneralDecoder().extractNumericValueFromBitArray(HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, FIRST_THREE_DIGITS_SIZE);
int firstThreeDigits = this.getGeneralDecoder().extractNumericValueFromBitArray(
HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, FIRST_THREE_DIGITS_SIZE);
if (firstThreeDigits / 100 == 0) {
buf.append('0');
}
@ -69,8 +69,8 @@ final class AI01393xDecoder extends AI01decoder {
}
buf.append(firstThreeDigits);
DecodedInformation generalInformation =
this.getGeneralDecoder().decodeGeneralPurposeField(HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE + FIRST_THREE_DIGITS_SIZE, null);
DecodedInformation generalInformation = this.getGeneralDecoder().decodeGeneralPurposeField(
HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE + FIRST_THREE_DIGITS_SIZE, null);
buf.append(generalInformation.getNewString());
return buf.toString();

View file

@ -70,8 +70,4 @@ final class DecodedNumeric extends DecodedObject {
return this.secondDigit == FNC1;
}
boolean isAnyFNC1() {
return this.firstDigit == FNC1 || this.secondDigit == FNC1;
}
}

View file

@ -276,12 +276,7 @@ final class FieldParser {
private static String processVariableAI(int aiSize, int variableFieldSize, String rawInformation)
throws NotFoundException {
String ai = rawInformation.substring(0, aiSize);
int maxSize;
if (rawInformation.length() < aiSize + variableFieldSize) {
maxSize = rawInformation.length();
} else {
maxSize = aiSize + variableFieldSize;
}
int maxSize = Math.min(rawInformation.length(), aiSize + variableFieldSize);
String field = rawInformation.substring(aiSize, maxSize);
String remaining = rawInformation.substring(maxSize);
String result = '(' + ai + ')' + field;

View file

@ -126,7 +126,8 @@ final class GeneralAppIdDecoder {
DecodedInformation lastDecoded = parseBlocks();
if (lastDecoded != null && lastDecoded.isRemaining()) {
return new DecodedInformation(this.current.getPosition(), this.buffer.toString(), lastDecoded.getRemainingValue());
return new DecodedInformation(this.current.getPosition(),
this.buffer.toString(), lastDecoded.getRemainingValue());
}
return new DecodedInformation(this.current.getPosition(), this.buffer.toString());
}

View file

@ -152,11 +152,10 @@ public final class Version {
for (int x = 0; x < max; x++) {
int i = alignmentPatternCenters[x] - 2;
for (int y = 0; y < max; y++) {
if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) {
// No alignment patterns near the three finder patterns
continue;
if ((x != 0 || (y != 0 && y != max - 1)) && (x != max - 1 || y != 0)) {
bitMatrix.setRegion(alignmentPatternCenters[y] - 2, i, 5, 5);
}
bitMatrix.setRegion(alignmentPatternCenters[y] - 2, i, 5, 5);
// else no o alignment patterns near the three finder patterns
}
}

View file

@ -25,7 +25,6 @@ import com.google.zxing.common.BitMatrix;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@ -614,7 +613,7 @@ public class FinderPatternFinder {
throw NotFoundException.getNotFoundInstance();
}
Collections.sort(possibleCenters, moduleComparator);
possibleCenters.sort(moduleComparator);
double distortion = Double.MAX_VALUE;
double[] squares = new double[3];
@ -665,7 +664,7 @@ public class FinderPatternFinder {
}
/**
* <p>Orders by {@link FinderPatternFinder#getEstimatedModuleSize()}</p>
* <p>Orders by {@link FinderPattern#getEstimatedModuleSize()}</p>
*/
private static final class EstimatedModuleComparator implements Comparator<FinderPattern>, Serializable {
@Override

View file

@ -19,11 +19,10 @@ package com.google.zxing.multi.qrcode;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
@ -62,8 +61,7 @@ public final class MultiQRCodeTestCase extends Assert {
for (Result result : results) {
barcodeContents.add(result.getText());
assertEquals(BarcodeFormat.QR_CODE, result.getBarcodeFormat());
Map<ResultMetadataType,Object> metadata = result.getResultMetadata();
assertNotNull(metadata);
assertNotNull(result.getResultMetadata());
}
Collection<String> expectedContents = new HashSet<>();
expectedContents.add("You earned the class a 5 MINUTE DANCE PARTY!! Awesome! Way to go! Let's boogie!");
@ -78,7 +76,7 @@ public final class MultiQRCodeTestCase extends Assert {
Result sa1 = new Result("SA1", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
Result sa2 = new Result("SA2", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
Result sa3 = new Result("SA3", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
sa1.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, (0 << 4) + 2);
sa1.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, 2);
sa1.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
sa2.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, (1 << 4) + 2);
sa2.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
@ -88,11 +86,7 @@ public final class MultiQRCodeTestCase extends Assert {
Result nsa = new Result("NotSA", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
nsa.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
List<Result> inputs = new ArrayList<>();
inputs.add(sa3);
inputs.add(sa1);
inputs.add(nsa);
inputs.add(sa2);
List<Result> inputs = Arrays.asList(sa3, sa1, nsa, sa2);
List<Result> results = QRCodeMultiReader.processStructuredAppend(inputs);
assertNotNull(results);

View file

@ -69,7 +69,7 @@ public final class RSSExpandedImage2resultTestCase extends Assert {
null, null, null, null, null, null,
"001750",
ExpandedProductParsedResult.KILOGRAM,
"3", null, null, null, new HashMap<String,String>());
"3", null, null, null, new HashMap<>());
assertCorrectImage2result("2.png", expected);
}

View file

@ -40,7 +40,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.HashMap;
@ -113,14 +112,7 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
// ignore
}
}
Collections.sort(results, new Comparator<Result>() {
@Override
public int compare(Result arg0, Result arg1) {
PDF417ResultMetadata resultMetadata = getMeta(arg0);
PDF417ResultMetadata otherResultMetadata = getMeta(arg1);
return resultMetadata.getSegmentIndex() - otherResultMetadata.getSegmentIndex();
}
});
results.sort(Comparator.comparingInt((Result r) -> getMeta(r).getSegmentIndex()));
StringBuilder resultText = new StringBuilder();
String fileId = null;
for (Result result : results) {
@ -194,11 +186,7 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
for (Path file : getImageFiles()) {
String testImageFileName = file.getFileName().toString();
String fileBaseName = testImageFileName.substring(0, testImageFileName.indexOf('-'));
List<Path> files = result.get(fileBaseName);
if (files == null) {
files = new ArrayList<>();
result.put(fileBaseName, files);
}
List<Path> files = result.computeIfAbsent(fileBaseName, k -> new ArrayList<>());
files.add(file);
}
return result;

View file

@ -27,82 +27,42 @@ public final class DataMaskTestCase extends Assert {
@Test
public void testMask0() {
testMaskAcrossDimensions(0, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return (i + j) % 2 == 0;
}
});
testMaskAcrossDimensions(0, (i, j) -> (i + j) % 2 == 0);
}
@Test
public void testMask1() {
testMaskAcrossDimensions(1, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return i % 2 == 0;
}
});
testMaskAcrossDimensions(1, (i, j) -> i % 2 == 0);
}
@Test
public void testMask2() {
testMaskAcrossDimensions(2, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return j % 3 == 0;
}
});
testMaskAcrossDimensions(2, (i, j) -> j % 3 == 0);
}
@Test
public void testMask3() {
testMaskAcrossDimensions(3, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return (i + j) % 3 == 0;
}
});
testMaskAcrossDimensions(3, (i, j) -> (i + j) % 3 == 0);
}
@Test
public void testMask4() {
testMaskAcrossDimensions(4, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return (i / 2 + j / 3) % 2 == 0;
}
});
testMaskAcrossDimensions(4, (i, j) -> (i / 2 + j / 3) % 2 == 0);
}
@Test
public void testMask5() {
testMaskAcrossDimensions(5, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return (i * j) % 2 + (i * j) % 3 == 0;
}
});
testMaskAcrossDimensions(5, (i, j) -> (i * j) % 2 + (i * j) % 3 == 0);
}
@Test
public void testMask6() {
testMaskAcrossDimensions(6, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
}
});
testMaskAcrossDimensions(6, (i, j) -> ((i * j) % 2 + (i * j) % 3) % 2 == 0);
}
@Test
public void testMask7() {
testMaskAcrossDimensions(7, new MaskCondition() {
@Override
public boolean isMasked(int i, int j) {
return ((i + j) % 2 + (i * j) % 3) % 2 == 0;
}
});
testMaskAcrossDimensions(7, (i, j) -> ((i + j) % 2 + (i * j) % 3) % 2 == 0);
}
private static void testMaskAcrossDimensions(int reference, MaskCondition condition) {
@ -126,6 +86,7 @@ public final class DataMaskTestCase extends Assert {
}
}
@FunctionalInterface
private interface MaskCondition {
boolean isMasked(int i, int j);
}

View file

@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>javase</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
@ -47,7 +47,7 @@
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<build>

View file

@ -1,47 +0,0 @@
/*
* Copyright 2016 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.client.j2se;
/**
* Abstraction over Base 64 decoding implementations that work across Java versions.
*/
abstract class Base64Decoder {
private static final Base64Decoder INSTANCE;
static {
Base64Decoder instance;
try {
Class.forName("java.util.Base64");
// If succeeds, then:
instance = new Java8Base64Decoder();
} catch (ClassNotFoundException cnfe) {
instance = new JAXBBase64Decoder();
}
INSTANCE = instance;
}
/**
* @param s Base-64 encoded string
* @return bytes that the string encodes
*/
abstract byte[] decode(String s);
static Base64Decoder getInstance() {
return INSTANCE;
}
}

View file

@ -87,13 +87,10 @@ public final class HtmlAssetTranslator {
String languageArg) throws IOException {
if ("all".equals(languageArg)) {
Collection<String> languages = new ArrayList<>();
DirectoryStream.Filter<Path> fileFilter = new DirectoryStream.Filter<Path>() {
@Override
public boolean accept(Path entry) {
String fileName = entry.getFileName().toString();
return Files.isDirectory(entry) && !Files.isSymbolicLink(entry) &&
fileName.startsWith("html-") && !"html-en".equals(fileName);
}
DirectoryStream.Filter<Path> fileFilter = entry -> {
String fileName = entry.getFileName().toString();
return Files.isDirectory(entry) && !Files.isSymbolicLink(entry) &&
fileName.startsWith("html-") && !"html-en".equals(fileName);
};
try (DirectoryStream<Path> dirs = Files.newDirectoryStream(assetsDir, fileFilter)) {
for (Path languageDir : dirs) {
@ -132,12 +129,9 @@ public final class HtmlAssetTranslator {
String translationTextTranslated =
StringsResourceTranslator.translateString("Translated by Google Translate.", language);
DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
@Override
public boolean accept(Path entry) {
String name = entry.getFileName().toString();
return name.endsWith(".html") && (filesToTranslate.isEmpty() || filesToTranslate.contains(name));
}
DirectoryStream.Filter<Path> filter = entry -> {
String name = entry.getFileName().toString();
return name.endsWith(".html") && (filesToTranslate.isEmpty() || filesToTranslate.contains(name));
};
try (DirectoryStream<Path> files = Files.newDirectoryStream(englishHtmlDir, filter)) {
for (Path sourceFile : files) {

View file

@ -21,6 +21,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URI;
import java.util.Base64;
/**
* Encapsulates reading URIs as images.
@ -60,7 +61,7 @@ public final class ImageReader {
throw new IOException("Unsupported data URI encoding");
}
String base64Data = uriString.substring(base64Start + BASE64TOKEN.length());
byte[] imageBytes = Base64Decoder.getInstance().decode(base64Data);
byte[] imageBytes = Base64.getDecoder().decode(base64Data);
return ImageIO.read(new ByteArrayInputStream(imageBytes));
}

View file

@ -1,36 +0,0 @@
/*
* Copyright 2016 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.client.j2se;
import java.lang.reflect.InvocationTargetException;
/**
* Uses {@code javax.xml.bind.DatatypeConverter}, which is not (necessarily) present
* in Java 9.
*/
final class JAXBBase64Decoder extends Base64Decoder {
@Override
byte[] decode(String s) {
try {
return (byte[]) Class.forName("javax.xml.bind.DatatypeConverter")
.getMethod("parseBase64Binary", String.class).invoke(null, s);
} catch (IllegalAccessException | InvocationTargetException |
NoSuchMethodException | ClassNotFoundException e) {
throw new IllegalStateException(e);
}
}
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2016 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.client.j2se;
import java.lang.reflect.InvocationTargetException;
/**
* Uses {@code java.util.Base64}, available in Java 8 and later
*/
final class Java8Base64Decoder extends Base64Decoder {
@Override
byte[] decode(String s) {
try {
Object decoder = Class.forName("java.util.Base64")
.getMethod("getDecoder").invoke(null);
return (byte[]) Class.forName("java.util.Base64$Decoder")
.getMethod("decode", String.class).invoke(decoder, s);
} catch (IllegalAccessException | NoSuchMethodException | ClassNotFoundException e) {
throw new IllegalStateException(e);
} catch (InvocationTargetException ite) {
throw new IllegalStateException(ite.getCause());
}
}
}

View file

@ -95,13 +95,9 @@ public final class StringsResourceTranslator {
Path stringsFile = valueDir.resolve("strings.xml");
Collection<String> forceRetranslation = Arrays.asList(args).subList(1, args.length);
DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
@Override
public boolean accept(Path entry) {
return Files.isDirectory(entry) && !Files.isSymbolicLink(entry) &&
VALUES_DIR_PATTERN.matcher(entry.getFileName().toString()).matches();
}
};
DirectoryStream.Filter<Path> filter = entry ->
Files.isDirectory(entry) && !Files.isSymbolicLink(entry) &&
VALUES_DIR_PATTERN.matcher(entry.getFileName().toString()).matches();
try (DirectoryStream<Path> dirs = Files.newDirectoryStream(resDir, filter)) {
for (Path dir : dirs) {
translate(stringsFile, dir.resolve("strings.xml"), forceRetranslation);

View file

@ -1,35 +0,0 @@
/*
* Copyright 2017 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.client.j2se;
import org.junit.Assert;
import org.junit.Test;
import java.nio.charset.StandardCharsets;
/**
* Tests {@link Base64Decoder}.
*/
public final class Base64DecoderTestCase extends Assert {
@Test
public void testEncode() {
Base64Decoder decoder = Base64Decoder.getInstance();
assertArrayEquals("foo".getBytes(StandardCharsets.UTF_8), decoder.decode("Zm9v"));
}
}

42
pom.xml
View file

@ -19,7 +19,7 @@
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencyManagement>
@ -64,7 +64,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13-beta-3</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -81,12 +81,12 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
<proguard.version>6.0.3</proguard.version>
<java.version>1.8</java.version>
<proguard.version>6.1.0</proguard.version>
<proguard.plugin.version>2.0.14</proguard.plugin.version>
<slf4j.version>1.7.25</slf4j.version>
<slf4j.version>1.8.0-beta4</slf4j.version>
<!-- This can't reference project.version as some subprojects version differently -->
<zxing.version>3.3.4-SNAPSHOT</zxing.version>
<zxing.version>3.4.0-SNAPSHOT</zxing.version>
<android.platform>22</android.platform>
<maven.scm.version>1.9.5</maven.scm.version>
</properties>
@ -122,6 +122,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
@ -154,12 +158,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-Xlint:-serial</arg>
</compilerArgs>
</configuration>
</plugin>
@ -228,7 +233,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -336,7 +341,7 @@
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.5.0</version>
<version>4.6.0</version>
<extensions>true</extensions>
<executions>
<execution>
@ -458,7 +463,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.18</version>
<version>8.20</version>
</dependency>
</dependencies>
</plugin>
@ -521,7 +526,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<version>0.8.4</version>
<executions>
<execution>
<goals>
@ -658,6 +663,7 @@
</licenses>
<developers>
<developer>
<id>zxing-authors</id>
<name>ZXing Authors</name>
</developer>
</developers>
@ -824,20 +830,6 @@
<module>zxing.appspot.com</module>
</modules>
</profile>
<profile>
<id>checkstyle</id>
<activation>
<jdk>[1.8,)</jdk> <!-- won't work with JDK 7 -->
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>javadoc-9</id>
<activation>

View file

@ -59,8 +59,6 @@
<module name="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
<!-- see http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarningsHolder -->
<module name="SuppressWarningsHolder"/>

View file

@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>zxing.appspot.com</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
@ -33,7 +33,7 @@
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<properties>

View file

@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>zxingorg</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
@ -33,13 +33,13 @@
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<version>8.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>26.0-android</version>
<version>27.1-android</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@ -49,13 +49,13 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.22.RELEASE</version> <!-- 5.x requires Java 8 -->
<version>5.1.7.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<version>4.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -63,7 +63,7 @@
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<build>

View file

@ -77,7 +77,7 @@ public final class DoSFilterTestCase extends Assert {
}
}
private void initFilter(Filter filter) throws ServletException {
private static void initFilter(Filter filter) throws ServletException {
MockFilterConfig config = new MockFilterConfig();
config.addInitParameter("maxAccessPerTime", Integer.toString(MAX_ACCESS_PER_TIME));
config.addInitParameter("accessTimeSec", "60");
@ -85,7 +85,7 @@ public final class DoSFilterTestCase extends Assert {
filter.init(config);
}
private void testRequest(Filter filter, String host, String proxy, int expectedStatus)
private static void testRequest(Filter filter, String host, String proxy, int expectedStatus)
throws IOException, ServletException {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setRequestURI("/");