Skip to content

Commit e3ed030

Browse files
committed
[RELEASE] iText 9.4.0
2 parents db3cb38 + 968079d commit e3ed030

File tree

1,010 files changed

+25541
-3225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,010 files changed

+25541
-3225
lines changed

barcodes/pom.xml

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@
55
<parent>
66
<groupId>com.itextpdf</groupId>
77
<artifactId>root</artifactId>
8-
<version>9.3.0</version>
8+
<version>9.4.0</version>
99
</parent>
1010

1111
<artifactId>barcodes</artifactId>
1212

1313
<name>iText - barcodes</name>
1414
<url>https://itextpdf.com/</url>
1515

16+
<properties>
17+
<sharpen.phase>install</sharpen.phase>
18+
<sharpen.projectName>barcodes</sharpen.projectName>
19+
<sharpen.cSharpTargetFolder>./../../../sharp/itextcore</sharpen.cSharpTargetFolder>
20+
<sharpen.cSharpSourceCodeDestination>itext/itext.barcodes</sharpen.cSharpSourceCodeDestination>
21+
<sharpen.cSharpTestCodeDestination>itext.tests/itext.barcodes.tests</sharpen.cSharpTestCodeDestination>
22+
</properties>
23+
1624
<dependencies>
1725
<dependency>
1826
<groupId>com.itextpdf</groupId>
@@ -37,47 +45,4 @@
3745
</resource>
3846
</resources>
3947
</build>
40-
41-
<profiles>
42-
<profile>
43-
<id>with-sharpen</id>
44-
<build>
45-
<plugins>
46-
<plugin>
47-
<groupId>sharpen</groupId>
48-
<artifactId>sharpen-maven-plugin</artifactId>
49-
<executions>
50-
<execution>
51-
<phase>install</phase>
52-
<goals>
53-
<goal>sharpen</goal>
54-
</goals>
55-
</execution>
56-
</executions>
57-
<dependencies>
58-
<dependency>
59-
<groupId>sharpen</groupId>
60-
<artifactId>standard-framework-mapping</artifactId>
61-
<version>1.0-SNAPSHOT</version>
62-
</dependency>
63-
</dependencies>
64-
<configuration>
65-
<projectName>barcodes</projectName>
66-
<cSharpTargetFolder>./../../../sharp/itextcore</cSharpTargetFolder>
67-
<cSharpSourceCodeDestination>itext/itext.barcodes</cSharpSourceCodeDestination>
68-
<cSharpTestCodeDestination>itext.tests/itext.barcodes.tests</cSharpTestCodeDestination>
69-
<buildDotnet>${sharpen.builddotnet}</buildDotnet>
70-
<showDiff>${sharpen.showdiff}</showDiff>
71-
<sourceCodeFiles>
72-
<file>**/src/main/java/**/*.java</file>
73-
</sourceCodeFiles>
74-
<testCodeFiles>
75-
<file>**/src/test/java/**/*.java</file>
76-
</testCodeFiles>
77-
</configuration>
78-
</plugin>
79-
</plugins>
80-
</build>
81-
</profile>
82-
</profiles>
8348
</project>

barcodes/src/main/java/com/itextpdf/barcodes/Barcode128.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public static String getHumanReadableUCCEAN(String code) {
299299
if (code.length() < k)
300300
break;
301301
int subcode = Integer.parseInt(code.substring(0, k));
302-
n = ais.containsKey(subcode) ? (int)ais.get(subcode) : 0;
302+
n = (int) ais.getOrDefault(subcode, 0);
303303
if (n != 0) {
304304
idlen = k;
305305
break;
@@ -679,7 +679,7 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
679679
public void setCode(String code) {
680680
if (getCodeType() == Barcode128.CODE128_UCC && code.startsWith("(")) {
681681
int idx = 0;
682-
StringBuilder ret = new StringBuilder("");
682+
StringBuilder ret = new StringBuilder();
683683
while (idx >= 0) {
684684
int end = code.indexOf(')', idx);
685685
if (end < 0) {
@@ -694,7 +694,7 @@ public void setCode(String code) {
694694
if (len == 0) {
695695
throw new IllegalArgumentException("AI not found");
696696
}
697-
sai = Integer.valueOf(ai).toString();
697+
sai = Integer.toString(ai);
698698
if (sai.length() == 1) {
699699
sai = "0" + sai;
700700
}
@@ -884,7 +884,7 @@ static boolean isNextDigits(String text, int textIndex, int numDigits) {
884884
* @return the packed digits, two digits per character
885885
*/
886886
static String getPackedRawDigits(String text, int textIndex, int numDigits) {
887-
StringBuilder out = new StringBuilder("");
887+
StringBuilder out = new StringBuilder();
888888
int start = textIndex;
889889
while (numDigits > 0) {
890890
if (text.charAt(textIndex) == FNC1) {
@@ -897,6 +897,7 @@ static String getPackedRawDigits(String text, int textIndex, int numDigits) {
897897
int c2 = text.charAt(textIndex++) - '0';
898898
out.append((char) (c1 * 10 + c2));
899899
}
900-
return (char) (textIndex - start) + out.toString();
900+
out.insert(0, (char) (textIndex - start));
901+
return out.toString();
901902
}
902903
}

barcodes/src/main/java/com/itextpdf/barcodes/Barcode39.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public static byte[] getBarsCode39(String text) {
173173
* @return the escaped text
174174
*/
175175
public static String getCode39Ex(String text) {
176-
StringBuilder out = new StringBuilder("");
176+
StringBuilder out = new StringBuilder();
177177
for (int k = 0; k < text.length(); ++k) {
178178
char c = text.charAt(k);
179179
if (c > 127) {

barcodes/src/main/java/com/itextpdf/barcodes/BarcodeDataMatrix.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public int setCode(String text) {
335335
try {
336336
t = text.getBytes(encoding);
337337
} catch (UnsupportedEncodingException exc) {
338-
throw new IllegalArgumentException("text has to be encoded in iso-8859-1");
338+
throw new IllegalArgumentException("text has to be encoded in iso-8859-1", exc);
339339
}
340340
return setCode(t, 0, t.length);
341341
}
@@ -1090,18 +1090,15 @@ private int C40OrTextEncodation(byte[] text, int textOffset, int textLength, byt
10901090
requiredCapacityForC40orText += 2;
10911091
}
10921092
requiredCapacityForC40orText += basic.indexOf((char) c) >= 0 ? 1 : 2;
1093-
if (c > 127)
1094-
requiredCapacityForASCII += 2;
1095-
else {
1096-
if (j > 0 && isDigit(c) && isDigit(text[textOffset - j + 1] & 0xff)) {
1097-
requiredCapacityForC40orText += basic.indexOf((char) text[textOffset - j + 1]) >= 0 ? 1 : 2;
1098-
j--;
1099-
dataOffsetNew = requiredCapacityForASCII + 1;
1100-
}
1101-
requiredCapacityForASCII++;
1093+
if (j > 0 && isDigit(c) && isDigit(text[textOffset - j + 1] & 0xff)) {
1094+
requiredCapacityForC40orText += basic.indexOf((char) text[textOffset - j + 1]) >= 0 ? 1 : 2;
1095+
j--;
1096+
dataOffsetNew = requiredCapacityForASCII + 1;
11021097
}
1103-
if (j == 1)
1098+
requiredCapacityForASCII++;
1099+
if (j == 1) {
11041100
dataOffsetNew = requiredCapacityForASCII;
1101+
}
11051102
}
11061103
addLatch = (unlatch < 0) || ((dataOffset - requiredCapacityForASCII) != unlatch);
11071104
if (requiredCapacityForC40orText % 3 == 0 &&
@@ -1113,8 +1110,9 @@ private int C40OrTextEncodation(byte[] text, int textOffset, int textLength, byt
11131110
dataLength += addLatch ? dataOffsetNew : dataOffsetNew + 1;
11141111
break;
11151112
}
1116-
if (isDigit(text[textOffset - i] & 0xff) && isDigit(text[textOffset - i + 1] & 0xff))
1113+
if (isDigit(text[textOffset - i] & 0xff) && isDigit(text[textOffset - i + 1] & 0xff)) {
11171114
i--;
1115+
}
11181116
}
11191117
}
11201118
} else if (symbolIndex != -1) {

barcodes/src/main/java/com/itextpdf/barcodes/BarcodePDF417.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,10 @@ protected static int maxPossibleErrorLevel(int remain) {
13751375

13761376
/**
13771377
* Prints the segments to standard output.
1378+
*
1379+
* @deprecated Test method for printing a segment list to std out, to be removed
13781380
*/
1381+
@Deprecated
13791382
protected void dumpList() {
13801383
if (segmentList.size() == 0)
13811384
return;
@@ -1388,7 +1391,7 @@ protected void dumpList() {
13881391
if (c[j] == '\r')
13891392
c[j] = '\n';
13901393
}
1391-
StringBuffer sb = new StringBuffer();
1394+
StringBuilder sb = new StringBuilder();
13921395
sb.append(v.getType());
13931396
sb.append(c);
13941397
System.out.println(sb.toString());
@@ -1636,7 +1639,7 @@ private void macroCodes() {
16361639
}
16371640

16381641
private void append(int in, int len) {
1639-
StringBuffer sb = new StringBuffer(len + 1);
1642+
StringBuilder sb = new StringBuilder(len + 1);
16401643
sb.append(Integer.toString(in));
16411644
for (int i = sb.length(); i < len; i++) {
16421645
sb.insert(0, "0");

barcodes/src/main/java/com/itextpdf/barcodes/exceptions/WriterException.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ This file is part of the iText (R) project.
3030
*/
3131
public final class WriterException extends ITextException {
3232

33+
private static final long serialVersionUID = -9185997341735096449L;
34+
3335

3436
/**
3537
* Creates a WriterException.
@@ -46,5 +48,15 @@ public WriterException() {
4648
public WriterException(String message) {
4749
super(message);
4850
}
51+
52+
/**
53+
* Creates a WriterException with a specified detail message and a cause.
54+
*
55+
* @param message the detail message, which provides additional information about the exception
56+
* @param cause the cause of the exception
57+
*/
58+
public WriterException(String message, Throwable cause) {
59+
super(message, cause);
60+
}
4961
}
5062

barcodes/src/main/java/com/itextpdf/barcodes/qrcode/BitArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private static int[] makeArray(int size) {
159159
}
160160

161161
public String toString() {
162-
StringBuffer result = new StringBuffer(size);
162+
StringBuilder result = new StringBuilder(size);
163163
for (int i = 0; i < size; i++) {
164164
if ((i & 0x07) == 0) {
165165
result.append(' ');

barcodes/src/main/java/com/itextpdf/barcodes/qrcode/BitMatrix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public int getDimension() {
172172
}
173173

174174
public String toString() {
175-
StringBuffer result = new StringBuffer(height * (width + 1));
175+
StringBuilder result = new StringBuilder(height * (width + 1));
176176
for (int y = 0; y < height; y++) {
177177
for (int x = 0; x < width; x++) {
178178
result.append(get(x, y) ? "X " : " ");

barcodes/src/main/java/com/itextpdf/barcodes/qrcode/BitVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void xor(BitVector other) {
158158
* @return String representation of the bitvector
159159
*/
160160
public String toString() {
161-
StringBuffer result = new StringBuffer(sizeInBits);
161+
StringBuilder result = new StringBuilder(sizeInBits);
162162
for (int i = 0; i < sizeInBits; ++i) {
163163
if (at(i) == 0) {
164164
result.append('0');

barcodes/src/main/java/com/itextpdf/barcodes/qrcode/ByteMatrix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void clear(byte value) {
110110
* @return String representation
111111
*/
112112
public String toString() {
113-
StringBuffer result = new StringBuffer(2 * width * height + 2);
113+
StringBuilder result = new StringBuilder(2 * width * height + 2);
114114
for (int y = 0; y < height; ++y) {
115115
for (int x = 0; x < width; ++x) {
116116
switch (bytes[y][x]) {

0 commit comments

Comments
 (0)