summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2023-07-28 14:10:32 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2023-07-28 14:10:32 +0200
commitd49e5ec03afd09bbcdd703e4fd2faf453dbf686d (patch)
tree47cfa6db723d402956a23385fa83780204989b40
parentnew bug fix version (diff)
downloadUIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar
UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.gz
UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.bz2
UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.lz
UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.xz
UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.zst
UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.zip
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/org/uic/barcode/staticFrame/DataRecord.java2
-rw-r--r--src/main/java/org/uic/barcode/staticFrame/UTLAYDataRecord.java14
-rw-r--r--src/test/java/org/uic/barcode/test/utils/TestUtils.java11
4 files changed, 20 insertions, 9 deletions
diff --git a/pom.xml b/pom.xml
index 1f0b102..e18072b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.uic.barcode</groupId>
<artifactId>org.uic.barcode</artifactId>
- <version>1.4.2</version>
+ <version>1.4.3</version>
<packaging>jar</packaging>
<name>UIC barcode</name>
<description>encoding and decoding of Aztec barcode content according to UIC IRS 90918-9</description>
diff --git a/src/main/java/org/uic/barcode/staticFrame/DataRecord.java b/src/main/java/org/uic/barcode/staticFrame/DataRecord.java
index 16d3811..2b5fa42 100644
--- a/src/main/java/org/uic/barcode/staticFrame/DataRecord.java
+++ b/src/main/java/org/uic/barcode/staticFrame/DataRecord.java
@@ -106,7 +106,7 @@ public abstract class DataRecord {
String dataSize = new String(Arrays.copyOfRange(byteData, offset, offset + 4));
offset = offset + 4;
- int length = Integer.parseInt(dataSize) - 12;
+ int length = Integer.parseInt(dataSize.trim()) - 12;
this.setData(Arrays.copyOfRange(byteData, offset, offset + length));
decodeContent();
diff --git a/src/main/java/org/uic/barcode/staticFrame/UTLAYDataRecord.java b/src/main/java/org/uic/barcode/staticFrame/UTLAYDataRecord.java
index 2d403e4..0c2869a 100644
--- a/src/main/java/org/uic/barcode/staticFrame/UTLAYDataRecord.java
+++ b/src/main/java/org/uic/barcode/staticFrame/UTLAYDataRecord.java
@@ -125,7 +125,7 @@ public class UTLAYDataRecord extends DataRecord {
int elements = 0;
try {
- elements = Integer.parseInt(numberValue);
+ elements = Integer.parseInt(numberValue.trim());
} catch(NumberFormatException e){
//Do Nothing
}
@@ -138,7 +138,7 @@ public class UTLAYDataRecord extends DataRecord {
offset = offset + 2;
int line = 0;
try {
- line = Integer.parseInt(lineValue);
+ line = Integer.parseInt(lineValue.trim());
} catch(NumberFormatException e){
//Do Nothing
}
@@ -146,7 +146,7 @@ public class UTLAYDataRecord extends DataRecord {
offset = offset + 2;
int column = 0;
try {
- column = Integer.parseInt(columnValue);
+ column = Integer.parseInt(columnValue.trim());
} catch(NumberFormatException e){
//Do Nothing
}
@@ -154,7 +154,7 @@ public class UTLAYDataRecord extends DataRecord {
offset = offset + 2;
int height = 0;
try {
- height = Integer.parseInt(heightValue);
+ height = Integer.parseInt(heightValue.trim());
} catch(NumberFormatException e){
//Do Nothing
}
@@ -162,7 +162,7 @@ public class UTLAYDataRecord extends DataRecord {
offset = offset + 2;
int width = 0;
try {
- width = Integer.parseInt(widthValue);
+ width = Integer.parseInt(widthValue.trim());
} catch(NumberFormatException e){
//Do Nothing
}
@@ -170,7 +170,7 @@ public class UTLAYDataRecord extends DataRecord {
offset = offset + 1;
int format = 0;
try {
- format = Integer.parseInt(formatValue);
+ format = Integer.parseInt(formatValue.trim());
} catch(NumberFormatException e){
//Do Nothing
}
@@ -178,7 +178,7 @@ public class UTLAYDataRecord extends DataRecord {
offset = offset + 4;
int length = 0;
try {
- length = Integer.parseInt(lengthValue);
+ length = Integer.parseInt(lengthValue.trim());
} catch(NumberFormatException e){
//Do Nothing
}
diff --git a/src/test/java/org/uic/barcode/test/utils/TestUtils.java b/src/test/java/org/uic/barcode/test/utils/TestUtils.java
index 9791b02..cee5623 100644
--- a/src/test/java/org/uic/barcode/test/utils/TestUtils.java
+++ b/src/test/java/org/uic/barcode/test/utils/TestUtils.java
@@ -28,6 +28,17 @@ public class TestUtils {
}
+ /* s must be an even-length string. */
+ public static byte[] hexStringToByteArray(String s) {
+ int len = s.length();
+ byte[] data = new byte[len / 2];
+ for (int i = 0; i < len; i += 2) {
+ data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ + Character.digit(s.charAt(i+1), 16));
+ }
+ return data;
+ }
+
public static Date parseDate (String source){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");