Skip to content

Commit

Permalink
fix: check before assuning name is jdkprovider
Browse files Browse the repository at this point in the history
  • Loading branch information
maxandersen committed Aug 12, 2024
1 parent b90c7e5 commit 3761694
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/dev/jbang/net/JdkProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ default Jdk createJdk(@Nonnull String id, @Nullable Path home, @Nonnull String v

default String name() {
String nm = getClass().getSimpleName();
// TODO: this 11 is here assuming it ends in "JdkProvider" - dont make that
// broken assumption
return nm.substring(0, nm.length() - 11).toLowerCase();
if(nm.endsWith("JdkProvider")) {
return nm.substring(0, nm.length() - 11).toLowerCase();
} else {
return nm.toLowerCase();
}
}

/**
Expand Down

0 comments on commit 3761694

Please sign in to comment.