Skip to content

Commit a88d302

Browse files
author
Andreas Dann
committed
add -cp as argument
1 parent bd47385 commit a88d302

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/de/codeshield/log4jshell/Log4JProcessDetector.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ public static void main(String[] args) throws IOException {
3434
// analyze each output
3535
// search for the "-classpath" parameter
3636
for (String outputLine : lines) {
37-
final String searchStr = "-classpath";
38-
final int i = StringUtils.indexOf(outputLine, searchStr);
37+
String searchStr = "-classpath";
38+
int i = StringUtils.indexOf(outputLine, searchStr);
39+
if (i == -1) {
40+
// check if someone used -cp
41+
searchStr = "-cp";
42+
i = StringUtils.indexOf(outputLine, searchStr);
43+
}
44+
3945
if (i > 0) {
4046
String cpArgs = outputLine.substring(i + searchStr.length() + 1);
4147

0 commit comments

Comments
 (0)