From f2b0f217d3c791039781e4183a5990dd4e1ee493 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 17 Mar 2023 04:56:54 +1100 Subject: [PATCH] Issue #9400 Handle scan of weird jar format (#9433) --- .../org/eclipse/jetty/annotations/AnnotationParser.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java index 0ae5e2376f7f..cca4bb4d790c 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java @@ -931,6 +931,11 @@ public boolean isValidClassFileName(String name) LOG.debug("Not a class: {}", name); return false; } + + //get just the last name portion + int ldir = lc.lastIndexOf('/', lc.length()); + int c0 = (ldir < 0 ? 0 : ldir + 1); + lc = lc.substring(c0); if (lc.equals("module-info.class")) { @@ -940,9 +945,6 @@ public boolean isValidClassFileName(String name) } //skip any classfiles that are not a valid java identifier - int c0 = 0; - int ldir = name.lastIndexOf('/', name.length() - 6); - c0 = (ldir > -1 ? ldir + 1 : c0); if (!Character.isJavaIdentifierStart(name.charAt(c0))) { if (LOG.isDebugEnabled())