File tree Expand file tree Collapse file tree
src/main/java/edu/kit/datamanager/ro_crate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,11 +120,9 @@ public JsonNode getProperty(String propertyKey) {
120120 * @return the value of the property as a String or null if not found.
121121 */
122122 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 );
128126 }
129127
130128 @ JsonIgnore
Original file line number Diff line number Diff line change @@ -28,18 +28,13 @@ public String getVersion() {
2828 }
2929
3030 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" ;
3532
3633 try (InputStream input = resource .openStream ()) {
3734 Properties properties = new Properties ();
3835 properties .load (input );
3936 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" ;
4338 return version .trim ();
4439 } catch (IOException e ) {
4540 throw new IllegalStateException ("Failed to read version from properties file" , e );
Original file line number Diff line number Diff line change 1111 * {@see JsonUtilFunctions}.
1212 */
1313public class Graph {
14+
15+ private Graph () {
16+ // Private constructor to prevent instantiation
17+ }
18+
1419 /**
1520 * Finds an entity in the graph by its ID.
1621 *
You can’t perform that action at this time.
0 commit comments