Skip to content

Commit ab9db97

Browse files
committed
Release 1.0.1
1 parent ae557d2 commit ab9db97

7 files changed

Lines changed: 135 additions & 44 deletions

File tree

pom.xml

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>de.governikus</groupId>
66
<artifactId>identification-report-impl-java</artifactId>
7-
<version>1.0.1-SNAPSHOT</version>
7+
<version>1.0.1</version>
88

99
<name>Identification Report Implementation</name>
1010
<description>The identification report is a JSON structure used to identify natural or legal persons in government
@@ -31,7 +31,7 @@
3131

3232
<scm>
3333
<connection>${scm.repository}/Infrastruktur/maven/${project.artifactId}</connection>
34-
<tag>identification-report-impl-java</tag>
34+
<tag>identification-report-impl-java-1.0.1</tag>
3535
<url>https://hg.govkg.de/Infrastruktur/maven/${project.artifactId}</url>
3636
</scm>
3737

@@ -75,37 +75,37 @@
7575
<!--suppress UnresolvedMavenProperty -->
7676
<formatter-path>${project.basedir}</formatter-path>
7777

78-
<version.lombok>1.18.24</version.lombok>
78+
<version.lombok>1.18.26</version.lombok>
7979

80-
<version.vertx-json-schema>4.3.4</version.vertx-json-schema>
81-
<version.jackson>2.13.4</version.jackson>
82-
<version.jackson.databind>2.13.4.2</version.jackson.databind>
83-
<version.apache.commons.io>2.11.0</version.apache.commons.io>
84-
<version.nimbus.jose.jwt>9.25.4</version.nimbus.jose.jwt>
80+
<version.vertx-json-schema>4.3.8</version.vertx-json-schema>
81+
<version.jackson>2.14.2</version.jackson>
82+
<version.jackson.databind>2.14.2</version.jackson.databind>
83+
<version.nimbus.jose.jwt>9.30.1</version.nimbus.jose.jwt>
8584

8685
<!-- logging dependencies -->
87-
<version.slf4j>1.7.36</version.slf4j>
86+
<version.slf4j>2.0.6</version.slf4j>
8887

8988
<!-- test dependencies -->
90-
<version.junit.jupiter>5.7.2</version.junit.jupiter>
89+
<version.junit.jupiter>5.9.2</version.junit.jupiter>
9190
<version.hamcrest>2.2</version.hamcrest>
92-
<version.log4j2>2.18.0</version.log4j2>
91+
<version.log4j2>2.19.0</version.log4j2>
9392

9493
<!-- plugins -->
9594
<version.maven.compiler.plugin>3.10.1</version.maven.compiler.plugin>
96-
<version.maven.versions.plugin>2.12.0</version.maven.versions.plugin>
97-
<version.maven.surefire.plugin>3.0.0-M7</version.maven.surefire.plugin>
98-
<version.maven.deploy.plugin>3.0.0</version.maven.deploy.plugin>
95+
<version.maven.versions.plugin>2.14.2</version.maven.versions.plugin>
96+
<version.maven.surefire.plugin>3.0.0-M8</version.maven.surefire.plugin>
97+
<version.maven.deploy.plugin>3.1.0</version.maven.deploy.plugin>
9998
<version.maven.release.plugin>3.0.0-M7</version.maven.release.plugin>
100-
<version.maven.enforcer.plugin>3.1.0</version.maven.enforcer.plugin>
101-
<version.maven.formatter.plugin>2.19.0</version.maven.formatter.plugin>
99+
<version.maven.enforcer.plugin>3.2.1</version.maven.enforcer.plugin>
100+
<version.maven.formatter.plugin>2.22.0</version.maven.formatter.plugin>
102101
<version.maven.source.plugin>3.2.1</version.maven.source.plugin>
103102
<version.maven.javadoc.plugin>3.4.1</version.maven.javadoc.plugin>
104103
<version.maven.lombok.plugin>1.18.20.0</version.maven.lombok.plugin>
105-
<version.sonar.maven.plugin>3.9.0.2155</version.sonar.maven.plugin>
106-
<version.maven.dependency.plugin>3.3.0</version.maven.dependency.plugin>
107-
<version.dependency.check.maven>7.2.1</version.dependency.check.maven>
104+
<version.sonar.maven.plugin>3.9.1.2184</version.sonar.maven.plugin>
105+
<version.maven.dependency.plugin>3.5.0</version.maven.dependency.plugin>
106+
<version.dependency.check.maven>8.0.2</version.dependency.check.maven>
108107
<version.maven.jacoco.plugin>0.8.8</version.maven.jacoco.plugin>
108+
109109
</properties>
110110

111111
<dependencyManagement>
@@ -121,6 +121,11 @@
121121
<artifactId>vertx-json-schema</artifactId>
122122
<version>${version.vertx-json-schema}</version>
123123
</dependency>
124+
<dependency>
125+
<groupId>com.fasterxml.jackson.core</groupId>
126+
<artifactId>jackson-core</artifactId>
127+
<version>${version.jackson.databind}</version>
128+
</dependency>
124129
<dependency>
125130
<groupId>com.fasterxml.jackson.core</groupId>
126131
<artifactId>jackson-databind</artifactId>
@@ -131,11 +136,6 @@
131136
<artifactId>jackson-datatype-jsr310</artifactId>
132137
<version>${version.jackson}</version>
133138
</dependency>
134-
<dependency>
135-
<groupId>commons-io</groupId>
136-
<artifactId>commons-io</artifactId>
137-
<version>${version.apache.commons.io}</version>
138-
</dependency>
139139
<dependency>
140140
<groupId>com.nimbusds</groupId>
141141
<artifactId>nimbus-jose-jwt</artifactId>
@@ -206,6 +206,40 @@
206206
<dependency>
207207
<groupId>io.vertx</groupId>
208208
<artifactId>vertx-json-schema</artifactId>
209+
<exclusions>
210+
<exclusion>
211+
<artifactId>netty-codec-http</artifactId>
212+
<groupId>io.netty</groupId>
213+
</exclusion>
214+
<exclusion>
215+
<artifactId>netty-codec-http2</artifactId>
216+
<groupId>io.netty</groupId>
217+
</exclusion>
218+
<exclusion>
219+
<artifactId>netty-common</artifactId>
220+
<groupId>io.netty</groupId>
221+
</exclusion>
222+
<exclusion>
223+
<artifactId>netty-handler</artifactId>
224+
<groupId>io.netty</groupId>
225+
</exclusion>
226+
<exclusion>
227+
<artifactId>netty-handler-proxy</artifactId>
228+
<groupId>io.netty</groupId>
229+
</exclusion>
230+
<exclusion>
231+
<artifactId>netty-resolver</artifactId>
232+
<groupId>io.netty</groupId>
233+
</exclusion>
234+
<exclusion>
235+
<artifactId>netty-resolver-dns</artifactId>
236+
<groupId>io.netty</groupId>
237+
</exclusion>
238+
<exclusion>
239+
<artifactId>netty-transport</artifactId>
240+
<groupId>io.netty</groupId>
241+
</exclusion>
242+
</exclusions>
209243
</dependency>
210244
<dependency>
211245
<groupId>com.fasterxml.jackson.core</groupId>
@@ -215,10 +249,6 @@
215249
<groupId>com.fasterxml.jackson.datatype</groupId>
216250
<artifactId>jackson-datatype-jsr310</artifactId>
217251
</dependency>
218-
<dependency>
219-
<groupId>commons-io</groupId>
220-
<artifactId>commons-io</artifactId>
221-
</dependency>
222252
<dependency>
223253
<groupId>com.nimbusds</groupId>
224254
<artifactId>nimbus-jose-jwt</artifactId>

src/main/java/de/governikus/identification/report/constants/SchemaConstants.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package de.governikus.identification.report.constants;
22

33
import java.io.InputStream;
4-
import java.nio.charset.StandardCharsets;
54
import java.util.HashMap;
65
import java.util.Map;
7-
8-
import org.apache.commons.io.IOUtils;
6+
import java.util.Scanner;
97

108
import de.governikus.identification.report.objects.subjects.EidCardPersonRef;
119
import de.governikus.identification.report.objects.subjects.FinkPersonRefMinimal;
@@ -93,7 +91,12 @@ public static JsonSchema getSchema(String schemaLocation)
9391

9492
try (InputStream inputStream = SchemaValidator.class.getResourceAsStream(schemaLocation))
9593
{
96-
jsonSchemaString = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
94+
if (inputStream == null)
95+
{
96+
throw new IllegalArgumentException("Schema not found in given location: " + schemaLocation);
97+
}
98+
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
99+
jsonSchemaString = s.hasNext() ? s.next() : "";
97100
}
98101
JsonObject object = new JsonObject(jsonSchemaString);
99102
JsonSchema schema = JsonSchema.of(object);
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
package de.governikus.identification.report.objects;
22

3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
5+
import lombok.AllArgsConstructor;
6+
7+
38
/**
49
* describes the status of the identification report
510
*
611
* @author Pascal Knueppel
712
* @since 10.11.2022
813
*/
14+
@AllArgsConstructor
915
public enum IdStatus
1016
{
11-
SUCCESS, INCOMPLETE, FAILURE, UNKNOWN
17+
18+
SUCCESS("success"), INCOMPLETE("incomplete"), FAILURE("failure"), UNKNOWN("unknown");
19+
20+
private final String value;
21+
22+
@JsonValue
23+
public String value()
24+
{
25+
return this.value;
26+
}
27+
28+
@Override
29+
public String toString()
30+
{
31+
return this.value;
32+
}
1233
}

src/main/java/de/governikus/identification/report/objects/IdentificationReport.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.governikus.identification.report.objects;
22

33
import java.time.Instant;
4+
import java.time.temporal.ChronoUnit;
45
import java.util.HashMap;
56
import java.util.List;
67
import java.util.Map;
@@ -274,4 +275,32 @@ public String toString()
274275
{
275276
return toJson().encode();
276277
}
278+
279+
/**
280+
* Get the report time truncated to milliseconds
281+
*
282+
* @return report time with milliseconds
283+
*/
284+
public Instant getReportTime()
285+
{
286+
if (reportTime == null)
287+
{
288+
return null;
289+
}
290+
return reportTime.truncatedTo(ChronoUnit.MILLIS);
291+
}
292+
293+
/**
294+
* Get the identification date truncated to milliseconds
295+
*
296+
* @return report time with milliseconds
297+
*/
298+
public Instant getIdentificationTime()
299+
{
300+
if (identificationTime == null)
301+
{
302+
return null;
303+
}
304+
return identificationTime.truncatedTo(ChronoUnit.MILLIS);
305+
}
277306
}

src/main/java/de/governikus/identification/report/objects/subjects/SubjectRef.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package de.governikus.identification.report.objects.subjects;
22

33
import java.io.InputStream;
4-
import java.nio.charset.StandardCharsets;
54
import java.util.HashMap;
65
import java.util.Map;
76
import java.util.Optional;
8-
9-
import org.apache.commons.io.IOUtils;
7+
import java.util.Scanner;
108

119
import com.fasterxml.jackson.annotation.JsonAnyGetter;
1210
import com.fasterxml.jackson.annotation.JsonAnySetter;
@@ -74,7 +72,13 @@ public String getSchemaId()
7472
String schemaLocation = getSchemaLocation();
7573
try (InputStream inputStream = getClass().getResourceAsStream(schemaLocation))
7674
{
77-
JsonObject jsonObject = new JsonObject(IOUtils.toString(inputStream, StandardCharsets.UTF_8));
75+
if (inputStream == null)
76+
{
77+
throw new IllegalArgumentException("Schema not found in given location: " + schemaLocation);
78+
}
79+
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
80+
String jsonSchema = s.hasNext() ? s.next() : "";
81+
JsonObject jsonObject = new JsonObject(jsonSchema);
7882
schemaId = jsonObject.getString("$id");
7983
TYPE_TO_SCHEMA_ID_MAP.put(getClass(), schemaId);
8084
}

src/test/java/de/governikus/identification/report/constants/SchemaConstantsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package de.governikus.identification.report.constants;
22

33
import java.io.InputStream;
4-
import java.nio.charset.StandardCharsets;
4+
import java.util.Scanner;
55

6-
import org.apache.commons.io.IOUtils;
76
import org.junit.jupiter.api.Assertions;
87
import org.junit.jupiter.params.ParameterizedTest;
98
import org.junit.jupiter.params.provider.CsvSource;
@@ -38,7 +37,8 @@ public void testAuthenticationSchemaConstantsMatchFileIds(String fileLocation, S
3837
final String fileInput;
3938
try (InputStream inputStream = getClass().getResourceAsStream(fileLocation))
4039
{
41-
fileInput = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
40+
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
41+
fileInput = s.hasNext() ? s.next() : "";
4242
}
4343
JsonObject schemaJson = new JsonObject(fileInput);
4444
Assertions.assertEquals(schemaJson.getString("$id"), schemaId);

src/test/java/de/governikus/identification/report/setup/FileReferences.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
import java.io.IOException;
44
import java.io.InputStream;
5-
import java.nio.charset.StandardCharsets;
65
import java.security.KeyStore;
76
import java.util.Arrays;
87
import java.util.List;
8+
import java.util.Scanner;
99
import java.util.function.Function;
1010

11-
import org.apache.commons.io.IOUtils;
12-
1311
import lombok.SneakyThrows;
1412

1513

@@ -54,7 +52,13 @@ default String readResourceFile(String resourcePath, Function<String, String> ch
5452
{
5553
try (InputStream resourceInputStream = getClass().getResourceAsStream(resourcePath))
5654
{
57-
String content = IOUtils.toString(resourceInputStream, StandardCharsets.UTF_8.name());
55+
if (resourceInputStream == null)
56+
{
57+
throw new IllegalArgumentException("Resource not found in given location: " + resourcePath);
58+
}
59+
Scanner s = new Scanner(resourceInputStream).useDelimiter("\\A");
60+
61+
String content = s.hasNext() ? s.next() : "";
5862
if (changeResourceFileContent != null)
5963
{
6064
content = changeResourceFileContent.apply(content);

0 commit comments

Comments
 (0)