Skip to content

Commit 4b6a24e

Browse files
authored
Merge branch 'main' into wzh-UID2-5765-enclaveID-registration-auth-role
2 parents ee4c5a2 + 94ef910 commit 4b6a24e

File tree

6 files changed

+187
-223
lines changed

6 files changed

+187
-223
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.uid2</groupId>
77
<artifactId>uid2-shared</artifactId>
8-
<version>10.8.8-alpha-280-SNAPSHOT</version>
8+
<version>10.9.0</version>
99
<name>${project.groupId}:${project.artifactId}</name>
1010
<description>Library for all the shared uid2 operations</description>
1111
<url>https://github.com/IABTechLab/uid2docs</url>
@@ -60,7 +60,7 @@
6060

6161
<properties>
6262
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
63-
<vertx.version>4.5.13</vertx.version>
63+
<vertx.version>4.5.18</vertx.version>
6464
<!-- check micrometer.version vertx-micrometer-metrics consumes before bumping up -->
6565
<micrometer.version>1.12.2</micrometer.version>
6666
<image.version>${project.version}</image.version>

src/main/java/com/uid2/shared/store/salt/SaltFileParser.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,23 @@ public SaltEntry[] parseFileLines(String[] saltFileLines, Integer size) {
2727

2828
private SaltEntry parseLine(String line, int lineNumber) {
2929
try {
30-
final String[] fields = line.split(",");
30+
final String[] fields = line.split(",", -1);
3131
final long id = Integer.parseInt(fields[0]);
3232
final String hashedId = this.idHashingScheme.encode(id);
3333
final long lastUpdated = Long.parseLong(fields[1]);
3434
final String salt = fields[2];
35+
final long refreshFrom = Long.parseLong(fields[3]);
36+
final String previousSalt = trimToNull(fields[4]);
3537

36-
Long refreshFrom = null;
37-
String previousSalt = null;
38+
// TODO: The fields below should stop being optional once refreshable UIDs features get rolled out in production. We can remove them one by one as necessary.
39+
// AU, 2025/07/28
3840
SaltEntry.KeyMaterial currentKey = null;
3941
SaltEntry.KeyMaterial previousKey = null;
40-
41-
// TODO: The fields below should stop being optional once the refresh from, previous salt
42-
// and refreshable UIDs features get rolled out in production. We can remove them one by one as necessary.
43-
// AU, 2025/04/28
44-
if (fields.length > 3) {
45-
refreshFrom = Long.parseLong(fields[3]);
46-
}
47-
if (fields.length > 4) {
48-
previousSalt = fields[4];
49-
}
50-
if (fields.length > 7) {
42+
if (trimToNull(fields[5]) != null && trimToNull(fields[6]) != null) {
5143
currentKey = new SaltEntry.KeyMaterial(Integer.parseInt(fields[5]), fields[6], fields[7]);
5244
}
53-
if (fields.length > 10) {
45+
46+
if (trimToNull(fields[8]) != null && trimToNull(fields[9]) != null) {
5447
previousKey = new SaltEntry.KeyMaterial(Integer.parseInt(fields[8]), fields[9], fields[10]);
5548
}
5649

@@ -60,4 +53,7 @@ private SaltEntry parseLine(String line, int lineNumber) {
6053
}
6154
}
6255

56+
private String trimToNull(String s) {
57+
return s == null || s.isBlank() ? null : s.trim();
58+
}
6359
}

0 commit comments

Comments
 (0)