zxing / zxing

@@ -157,7 +157,7 @@
Loading
157 157
        throw FormatException.getFormatInstance();
158 158
      }
159 159
    }
160 -
    if (result.length() == 0) {
160 +
    if (result.length() == 0 && resultMetadata.getFileId() == null) {
161 161
      throw FormatException.getFormatInstance();
162 162
    }
163 163
    DecoderResult decoderResult = new DecoderResult(null, result.toString(), null, ecLevel);
@@ -179,9 +179,19 @@
Loading
179 179
    resultMetadata.setSegmentIndex(Integer.parseInt(decodeBase900toBase10(segmentIndexArray,
180 180
        NUMBER_OF_SEQUENCE_CODEWORDS)));
181 181
182 -
    StringBuilder fileId = new StringBuilder();
183 -
    codeIndex = textCompaction(codewords, codeIndex, fileId);
184 -
    resultMetadata.setFileId(fileId.toString());
182 +
    // Decoding the fileId codewords as 0-899 numbers, each 0-filled to width 3. This follows the spec
183 +
    // (See ISO/IEC 15438:2015 Annex H.6) and preserves all info, but some generators (e.g. TEC-IT) write
184 +
    // the fileId using text compaction, so in those cases the fileId will appear mangled.
185 +
    String fileId = "";
186 +
    for (int i = 0; codeIndex < codewords[0] && codewords[codeIndex] != MACRO_PDF417_TERMINATOR
187 +
                    && codewords[codeIndex] != BEGIN_MACRO_PDF417_OPTIONAL_FIELD; i++, codeIndex++) {
188 +
      fileId += String.format("%03d", codewords[codeIndex]);
189 +
    }
190 +
    if (fileId.length() == 0) {
191 +
      // at least one fileId codeword is required (Annex H.2)
192 +
      throw FormatException.getFormatInstance();
193 +
    }
194 +
    resultMetadata.setFileId(fileId);
185 195
186 196
    int optionalFieldsStart = -1;
187 197
    if (codewords[codeIndex] == BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {
Files Complexity Coverage
core/src/main/java/com/google/zxing 74.30% 82.50%
javase/src/main/java/com/google/zxing/client/j2se 25.79% 29.98%
zxingorg/src/main/java/com/google/zxing/web 43.07% 49.16%
Project Totals (251 files) 72.07% 79.27%
1144.1
TRAVIS_OS_NAME=linux
openjdk8=

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading