File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed
src/main/java/edu/kit/datamanager/ro_crate/writer Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -73,21 +73,21 @@ private ContextualEntity buildRoCrateJavaEntity(
73
73
}
74
74
75
75
private String loadVersionFromProperties () {
76
- try {
77
- URL resource = this . getClass (). getResource ( "/version.properties" );
78
- if ( resource != null ) {
79
- try ( InputStream input = resource . openStream ()) {
80
- Properties properties = new Properties ();
81
- properties . load ( input );
82
- return properties . getProperty ( "version" );
83
- }
84
- } else {
85
- System . err . println ( "Properties file not found!" );
86
- return "unknown" ;
76
+ URL resource = this . getClass (). getResource ( "/version.properties" );
77
+ if ( resource == null ) {
78
+ throw new IllegalStateException ( "version.properties not found in classpath. This indicates a build configuration issue." );
79
+ }
80
+
81
+ try ( InputStream input = resource . openStream ()) {
82
+ Properties properties = new Properties ( );
83
+ properties . load ( input );
84
+ String version = properties . getProperty ( "version" );
85
+ if ( version == null || version . trim (). isEmpty ()) {
86
+ throw new IllegalStateException ( "No version property found in version.properties" ) ;
87
87
}
88
+ return version .trim ();
88
89
} catch (IOException e ) {
89
- System .err .println ("Properties file not found!" );
90
- return "unknown" ;
90
+ throw new IllegalStateException ("Failed to read version from properties file" , e );
91
91
}
92
92
}
93
93
}
You can’t perform that action at this time.
0 commit comments