Skip to content

Endpoint /versions improved #236

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.1.15
- Endpoint /versions made more robust.

## 2.1.14
- Made changes to /generate end-point to improve efficiency how result of event generation is handled

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>

<properties>
<eiffel-remrem-generate.version>2.1.14</eiffel-remrem-generate.version>
<eiffel-remrem-generate.version>2.1.15</eiffel-remrem-generate.version>
<eiffel-remrem-semantics.version>2.2.7</eiffel-remrem-semantics.version>
</properties>
<artifactId>eiffel-remrem-generate</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,17 @@ public Map<String, Map<String, String>> getMessagingVersions() {
*/
public Map<String, String> getServiceVersion() {
String resourcesPath = this.getClass().getClassLoader().getResource("").getPath();
String manifestPath = resourcesPath.substring(0, resourcesPath.lastIndexOf(WEB_INF)).concat(META_INF_MANIFEST_MF);
int indexWebInf = resourcesPath.lastIndexOf(WEB_INF);
if (indexWebInf == -1) {
// "WEB-INF" was not found in the path, strange...
log.error("Cannot find '" + WEB_INF + "' in the path '" + resourcesPath +
"'. Not loaded from a WAR file?");
serviceVersion.put(VERSION, "\"ERROR: " + META_INF_MANIFEST_MF +
" not found; was the service run from a WAR file?\"");
return serviceVersion;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems strange that application is unable to read static file.... I dont think we should make code bulky by using failsafe codes when these issues are not observed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK Jainad, cancelling the PR completely.

String manifestPath = resourcesPath.substring(0, indexWebInf).concat(META_INF_MANIFEST_MF);
try {
Manifest manifest = new Manifest(new FileInputStream(manifestPath));
Attributes mainAttribs = manifest.getMainAttributes();
Expand Down