Skip to content

Conversation

@kessplas
Copy link
Contributor

Issue #, if available: #2114

Description of changes: See issue. Also, change the property name from version to esdkVersion to avoid the possibility of picking up the version 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:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

final ClassLoader loader = VersionInfo.class.getClassLoader();
properties.load(loader.getResourceAsStream("project.properties"));
return properties.getProperty("version");
String maybeVersion = properties.getProperty("esdkVersion");
Copy link

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.

Copy link
Contributor Author

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.

@kessplas kessplas marked this pull request as ready for review May 30, 2025 19:43
@kessplas kessplas requested a review from a team as a code owner May 30, 2025 19:43
Copy link
Contributor

@josecorella josecorella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@kessplas kessplas merged commit 313caa7 into master May 30, 2025
45 checks passed
@kessplas kessplas deleted the version-loader-fix branch May 30, 2025 20:24
josecorella pushed a commit that referenced this pull request Jun 4, 2025
## [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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants