Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
trying to address sonar findings for BundleEntryHandler (see SLING-10784) i noticed that there is no guarantee that 'artifactId' and 'version' are not left null after all the processing completed. if any of the two is null constructing a new ArtifactId object from the given strings will fail will IllegalArgumentException.
it might be as simple as extracting the following statements out of the previous block that handles the groupId == null case:
if (artifactId == null || artifactId.isEmpty()) { artifactId = groupId; } if (version == null) { Version osgiVersion = Version.parseVersion(getCheckedProperty(jarFile.getManifest(), Constants.BUNDLE_VERSION)); version = osgiVersion.getMajor() + "." + osgiVersion.getMinor() + "." + osgiVersion.getMicro() + (osgiVersion.getQualifier().isEmpty() ? "" : "-" + osgiVersion.getQualifier()); }
but i am not totally sure.... there is a reason the method BundleEntryHandler.extractArtifactId gets called out by sonar
note: on line 472 of the same method IllegalArgumentException is caught.... so i assume the code doesn't expect this method to fail upon building the ArtifactId.
Attachments
Issue Links
- relates to
-
SLING-10784 BundleEntryHandler - sonar findings
- Open