Skip to content

Commit

Permalink
Merge pull request #141 from hyperskill/master
Browse files Browse the repository at this point in the history
Null check added when searching for class name with Kt twist in the startSpring method
  • Loading branch information
inuur authored Mar 24, 2023
2 parents 032a790 + c37a4bf commit 0b5d326
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/hyperskill/hstest/stage/SpringTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static void startSpring() throws Exception {
.stream().map(Class::getCanonicalName)
.collect(Collectors.toList());
for (String name : allNameOfClasses) {
if (name.endsWith("Kt")) {
if (name != null && name.endsWith("Kt")) {
isKotlin = true;
break;
}
Expand Down Expand Up @@ -189,7 +189,8 @@ public static void startSpring() throws Exception {
} else {
List<Class<?>> allClassesFromPackage = ReflectionUtils.getAllClassesFromPackage("");
allClassesFromPackage.forEach(it -> {
if (it.getCanonicalName().endsWith("Kt")
if (it.getCanonicalName() != null
&& it.getCanonicalName().endsWith("Kt")
&& ReflectionUtils.hasMainMethod(it)
&& !springRunning) {
try {
Expand Down

0 comments on commit 0b5d326

Please sign in to comment.