Various code tweaks, action updates, dep updates

This commit is contained in:
Sean Owen 2022-10-20 14:13:34 -05:00
parent fa19d4758f
commit 0ea0ecddc5
14 changed files with 81 additions and 83 deletions

View file

@ -28,14 +28,14 @@ However, bug reports with a pull request are likely to be merged promptly.
Please search previous issues for an answer before opening a pull request. A few common ones
are listed here.
### I get a compilation error.
### I get a compilation error
While you can check the build status on Github to confirm,
the project correctly builds and passes tests at all times.
90% of the time it's due to using an old version of Java. Version 3.4+ require Java 8.
Use earlier versions with Java 7 and earlier.
### This barcode doesn't decode.
### This barcode doesn't decode
Not all images will decode. All else equal, more is better, but this is not accepted as a bug
report. A pull request that makes changes to make the barcode decode without decreasing the net

View file

@ -36,11 +36,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -51,7 +51,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@ -65,4 +65,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:

View file

@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Android SDK
run: if [ ! -d /tmp/android-sdk-linux/platforms ]; then curl -s https://storage.googleapis.com/zxing-build/android-sdk-linux.tar.bz2 | bunzip2 | tar xf - -C /tmp; else ls -l /tmp/android-sdk-linux; fi
- name: Set up JDK 8

View file

@ -70,7 +70,6 @@ library implemented in Java, with ports to other languages.
| [pyzxing](https://github.com/ChenjieXu/pyzxing) | Python wrapper to ZXing library
| [zxing-dart](https://github.com/shirne/zxing-dart) | Port to dart
### Other related third-party open source projects
| Module | Description
@ -94,9 +93,8 @@ on StackOverflow](https://stackoverflow.com/questions/tagged/zxing).
## Etcetera
[![Coverity Status](https://scan.coverity.com/projects/1924/badge.svg)](https://scan.coverity.com/projects/1924)
[![codecov.io](https://codecov.io/github/zxing/zxing/coverage.svg?branch=master)](https://codecov.io/github/zxing/zxing?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7270e4b57c50483699448bf32721ab10)](https://www.codacy.com/app/srowen/zxing?utm_source=github.com&utm_medium=referral&utm_content=zxing/zxing&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/zxing/zxing/branch/master/graph/badge.svg?token=6RrJHvUMDl)](https://codecov.io/gh/zxing/zxing)
[![Codacy](https://app.codacy.com/project/badge/Grade/5d1186edeb714f0187e3eb18cc6aeef1)](https://www.codacy.com/gh/zxing/zxing/dashboard?utm_source=github.com&utm_medium=referral&utm_content=zxing/zxing&utm_campaign=Badge_Grade)
QR code is trademarked by Denso Wave, inc. Thanks to Haase & Martin OHG for contributing the logo.

View file

@ -290,7 +290,7 @@ public class MinimalECIInput implements ECIInput {
}
}
if (minimalJ < 0) {
throw new RuntimeException("Internal error: failed to encode \"" + stringToEncode + "\"");
throw new IllegalStateException("Failed to encode \"" + stringToEncode + "\"");
}
List<Integer> intsAL = new ArrayList<>();
InputEdge current = edges[inputLength][minimalJ];

View file

@ -64,11 +64,13 @@ public final class StringUtils {
*/
public static String guessEncoding(byte[] bytes, Map<DecodeHintType,?> hints) {
Charset c = guessCharset(bytes, hints);
if (c == SHIFT_JIS_CHARSET) {
if (c.equals(SHIFT_JIS_CHARSET)) {
return "SJIS";
} else if (c == StandardCharsets.UTF_8) {
}
if (c.equals(StandardCharsets.UTF_8)) {
return "UTF8";
} else if (c == StandardCharsets.ISO_8859_1) {
}
if (c.equals(StandardCharsets.ISO_8859_1)) {
return "ISO8859_1";
}
return c.name();

View file

@ -472,7 +472,7 @@ public final class MinimalEncoder {
}
if (minimalJ < 0) {
throw new RuntimeException("Internal error: failed to encode \"" + input + "\"");
throw new IllegalStateException("Failed to encode \"" + input + "\"");
}
return new Result(edges[inputLength][minimalJ]);
}

View file

@ -435,8 +435,8 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
patternIndex = CODE_FNC_3;
break;
case ESCAPE_FNC_4:
if ((charset == Charset.A && latch != Latch.SHIFT) ||
(charset == Charset.B && latch == Latch.SHIFT)) {
if (charset == Charset.A && latch != Latch.SHIFT ||
charset == Charset.B && latch == Latch.SHIFT) {
patternIndex = CODE_FNC_4_A;
} else {
patternIndex = CODE_FNC_4_B;
@ -445,12 +445,11 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
default:
patternIndex = contents.charAt(i) - ' ';
}
if ((charset == Charset.A && latch != Latch.SHIFT) ||
(charset == Charset.B && latch == Latch.SHIFT)) {
if (patternIndex < 0) {
if ((charset == Charset.A && latch != Latch.SHIFT ||
charset == Charset.B && latch == Latch.SHIFT) &&
patternIndex < 0) {
patternIndex += '`';
}
}
addPattern(patterns, patternIndex, checkSum, checkWeight, i);
}
}

View file

@ -244,13 +244,13 @@ public final class PDF417ScanningDecoder {
throw NotFoundException.getNotFoundInstance();
}
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
} else if (numberOfCodewords[0] != calculatedNumberOfCodewords) {
if (calculatedNumberOfCodewords >= 1 && calculatedNumberOfCodewords <= PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
} else if (numberOfCodewords[0] != calculatedNumberOfCodewords &&
calculatedNumberOfCodewords >= 1 &&
calculatedNumberOfCodewords <= PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
// The calculated one is more reliable as it is derived from the row indicator columns
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
}
}
}
private static DecoderResult createDecoderResult(DetectionResult detectionResult) throws FormatException,
ChecksumException, NotFoundException {

View file

@ -370,13 +370,13 @@ final class PDF417HighLevelEncoder {
tmp.append((char) 27); //ll
continue;
} else {
if (startpos + idx + 1 < count) {
if (!input.isECI(startpos + idx + 1) && isPunctuation(input.charAt(startpos + idx + 1))) {
if (startpos + idx + 1 < count &&
!input.isECI(startpos + idx + 1) &&
isPunctuation(input.charAt(startpos + idx + 1))) {
submode = SUBMODE_PUNCTUATION;
tmp.append((char) 25); //pl
continue;
}
}
tmp.append((char) 29); //ps
tmp.append((char) PUNCTUATION[ch]);
}

View file

@ -235,7 +235,6 @@ public final class BitMatrixTestCase extends Assert {
fullMatrix.setRegion(0, 0, 3, 3);
BitMatrix centerMatrix = new BitMatrix(3, 3);
centerMatrix.setRegion(1, 1, 1, 1);
BitMatrix emptyMatrix24 = new BitMatrix(2, 4);
boolean[][] matrix = new boolean[3][3];
assertEquals(emptyMatrix, BitMatrix.parse(matrix));

22
pom.xml
View file

@ -165,7 +165,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<configuration>
<source>${java.version}</source>
<quiet>true</quiet>
@ -204,22 +204,22 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.0</version>
<version>3.4.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -262,12 +262,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>2.0.0-M1</version>
<version>2.0.0-M2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M2</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -277,7 +277,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -385,7 +385,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M2</version>
<version>4.0.0-M3</version>
<inherited>false</inherited>
</plugin>
<plugin>
@ -396,7 +396,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
<configuration>
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
@ -421,7 +421,7 @@
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.14</version>
<version>0.15</version>
<configuration>
<consoleOutput>true</consoleOutput>
<ignoreErrors>true</ignoreErrors>

View file

@ -73,7 +73,7 @@
</parent>
<properties>
<spring.version>5.3.21</spring.version>
<spring.version>5.3.23</spring.version>
</properties>
<build>