File tree Expand file tree Collapse file tree 3 files changed +10
-12
lines changed
src/main/java/edu/kit/datamanager/ro_crate Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -120,11 +120,9 @@ public JsonNode getProperty(String propertyKey) {
120
120
* @return the value of the property as a String or null if not found.
121
121
*/
122
122
public String getIdProperty (String propertyKey ) {
123
- JsonNode node = this .properties .get (propertyKey );
124
- if (node != null ) {
125
- return node .path ("@id" ).asText (null );
126
- }
127
- return null ;
123
+ return Optional .ofNullable (this .properties .get (propertyKey ))
124
+ .map (jsonNode -> jsonNode .path ("@id" ).asText (null ))
125
+ .orElse (null );
128
126
}
129
127
130
128
@ JsonIgnore
Original file line number Diff line number Diff line change @@ -28,18 +28,13 @@ public String getVersion() {
28
28
}
29
29
30
30
URL resource = this .getClass ().getResource ("/version.properties" );
31
- if (resource == null ) {
32
- throw new IllegalStateException (
33
- "version.properties not found in classpath. This indicates a build configuration issue." );
34
- }
31
+ assert resource != null : "version.properties not found in classpath" ;
35
32
36
33
try (InputStream input = resource .openStream ()) {
37
34
Properties properties = new Properties ();
38
35
properties .load (input );
39
36
String version = properties .getProperty ("version" );
40
- if (version == null || version .trim ().isEmpty ()) {
41
- throw new IllegalStateException ("No version property found in version.properties" );
42
- }
37
+ assert version != null : "Version property not found in version.properties" ;
43
38
return version .trim ();
44
39
} catch (IOException e ) {
45
40
throw new IllegalStateException ("Failed to read version from properties file" , e );
Original file line number Diff line number Diff line change 11
11
* {@see JsonUtilFunctions}.
12
12
*/
13
13
public class Graph {
14
+
15
+ private Graph () {
16
+ // Private constructor to prevent instantiation
17
+ }
18
+
14
19
/**
15
20
* Finds an entity in the graph by its ID.
16
21
*
You can’t perform that action at this time.
0 commit comments