-
Notifications
You must be signed in to change notification settings - Fork 121
fix: guard against null version and change property name to avoid conflicts #2116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -44,7 +45,15 @@ public static String versionNumber() { | |||
final Properties properties = new Properties(); | |||
final ClassLoader loader = VersionInfo.class.getClassLoader(); | |||
properties.load(loader.getResourceAsStream("project.properties")); | |||
return properties.getProperty("version"); | |||
String maybeVersion = properties.getProperty("esdkVersion"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the real problem is in line 47: the class loader will load only the first resource matching the name project.properties
. If some other JAR file on the classpath contains such a file and appears before this library on the classpath, it will be loaded instead of this library's project.properties
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, this just prevents the program from crashing. I'm going to explore ways to load the specific project.properties
file next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
## [3.0.2](v3.0.1...v3.0.2) (2025-06-04) ### Fixes * **AwsCrypto:** remove pre-mature Deprecation notices ([#2118](#2118)) ([4a19b04](4a19b04)) * do not truncate encrypted streams when offset is greater than zero ([#2113](#2113)) ([adb0a42](adb0a42)) * guard against null version and change property name to avoid conflicts ([#2116](#2116)) ([313caa7](313caa7)) ### Maintenance * add a test for offset against BlockEncryptionHandler ([#2115](#2115)) ([08cf1a3](08cf1a3)) * bump to latest mpl ([#2046](#2046)) ([6dd2d12](6dd2d12)) * **cfn:** Sonatype Migration to User Tokens; updated policies for CI project ([#2043](#2043)) ([7cfe049](7cfe049)) * **deps-dev:** bump commons-io:commons-io from 2.11.0 to 2.14.0 ([#2047](#2047)) ([1695a39](1695a39)) * **examples:** Shared cache across Hierarchical Keyrings ([#2045](#2045)) ([fd00cd0](fd00cd0)) * fix semantic release installation ([#2119](#2119)) ([0586279](0586279)) * **JavaDocs:** detail thread saftey of SDK Client Builders ([#2048](#2048)) ([86d5b62](86d5b62)) * move release to Nexus Central ([#2117](#2117)) ([9e91dad](9e91dad))
Issue #, if available: #2114
Description of changes: See issue. Also, change the property name from
version
toesdkVersion
to avoid the possibility of picking up theversion
property from another project which has been loaded before the ESDK's.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: