Skip to content

Commit

Permalink
fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
f2par0 committed Jan 30, 2025
1 parent 3af39fc commit 9d51b4a
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class EnsureWrapBundleNameMojo extends AbstractWrapBundleMojo {
private static final String BUNDLE_NAME = "Bundle-Name";
private static final String BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName";

static String toPascalCase(String kebabCase) {
private static String toPascalCase(String kebabCase) {
// Handle null or empty string
if (kebabCase == null || kebabCase.isEmpty()) {
return kebabCase;
Expand Down Expand Up @@ -86,7 +86,7 @@ protected boolean processWrappedBundle(WrappedBundle wrappedBundle) {
String processLocation(WrappedBundle wrappedBundle) throws Exception {
String location = wrappedBundle.getBundle().getLocation();
String instructions = wrappedBundle.getInstructions();
boolean dollarNeeded = !(instructions != null && instructions.contains("$"));
boolean dollarNeeded = instructions == null || !instructions.contains("$");

String bundleNameHeader = "%s=Wrap%%20of%%20%s".formatted(BUNDLE_NAME, toPascalCase(wrappedBundle.getArtifactId()));
String bundleSymbolicNameHeader = "%s=wrap_%s.%s".formatted(BUNDLE_SYMBOLIC_NAME, wrappedBundle.getGroupId(), wrappedBundle.getArtifactId());
Expand Down Expand Up @@ -115,14 +115,12 @@ private String insertHeaderIfNeeded(boolean dollarNeeded, String location, Map<S
// "amp;" is automatically added
dollarNeeded = false;
location = sb.insert(versionHeaderStartIndex, "$%s&".formatted(entry.getValue())).toString();
hasChanged = true;
break;
} else {
// "amp;" is automatically added
location = sb.insert(versionHeaderStartIndex, "%s&".formatted(entry.getValue())).toString();
hasChanged = true;
break;
}
hasChanged = true;
break;
}
}
if (hasChanged) {
Expand Down

0 comments on commit 9d51b4a

Please sign in to comment.