Skip to content

Commit

Permalink
Fix issue with OSGi when having package name starting with "class" (e…
Browse files Browse the repository at this point in the history
…clipse-ee4j#4235)

Signed-off-by: Jan Supol <[email protected]>
  • Loading branch information
jansupol authored and pa314159 committed Sep 3, 2019
1 parent 33ebc2c commit ec0abb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static String bundleEntryPathToClassName(String packagePath, String bundl
: packagePath + bundleEntryPath.substring(bundleEntryPath.lastIndexOf('/') + 1);

return (normalizedClassNamePath.startsWith("/") ? normalizedClassNamePath.substring(1) : normalizedClassNamePath)
.replace('/', '.').replace(".class", "");
.replace(".class", "").replace('/', '.');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ public void testRootWebInfClassesBundleEntryPathTranslationNoLeadingSlash() {
Assert.assertEquals("org.glassfish.jersey.Test", className);
}

@Test
public void testDotClassInPackageName() {
String className = OsgiRegistry.bundleEntryPathToClassName("/", "com/classification/Test");
Assert.assertEquals("com.classification.Test", className);
}

@Test
public void testRootWebInfClassesBundleEntryPathEsTranslation() {
String className = OsgiRegistry.bundleEntryPathToClassName("es", "/WEB-INF/classes/es/a/Test.class");
Expand Down

0 comments on commit ec0abb4

Please sign in to comment.