Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSHADE-452]Fix ServiceResourceTransformer not correct issue. #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private String shadeSourceWithExcludes(
StringBuilder shadedSourceContent = new StringBuilder(sourceContent.length() * 11 / 10);
boolean isFirstSnippet = true;
// Make sure that search pattern starts at word boundary and that we look for literal ".", not regex jokers
String[] snippets = sourceContent.split("\\b" + patternFrom.replace(".", "[.]") + "\\b");
String[] snippets = sourceContent.split("\\b" + patternFrom.replace(".", "[.]"));
for (int i = 0, snippetsLength = snippets.length; i < snippetsLength; i++) {
String snippet = snippets[i];
String previousSnippet = isFirstSnippet ? "" : snippets[i - 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void relocatedClasses() throws Exception {
new SimpleRelocator("org.foo", "borg.foo", null, Arrays.asList("org.foo.exclude.*"));
relocators.add(relocator);

String content = "org.foo.Service\norg.foo.exclude.OtherService\n";
String content = "org.foo.Service\norg.foo.exclude.OtherService\norg.fooPart.exclude.OtherService\n";
byte[] contentBytes = content.getBytes(StandardCharsets.UTF_8);
InputStream contentStream = new ByteArrayInputStream(contentBytes);
String contentResource = "META-INF/services/org.foo.something.another";
Expand All @@ -76,7 +76,10 @@ public void relocatedClasses() throws Exception {
assertNotNull(jarEntry);
try (InputStream entryStream = jarFile.getInputStream(jarEntry)) {
String xformedContent = IOUtils.toString(entryStream, "utf-8");
assertEquals("borg.foo.Service" + NEWLINE + "org.foo.exclude.OtherService" + NEWLINE, xformedContent);
assertEquals(
"borg.foo.Service" + NEWLINE + "org.foo.exclude.OtherService" + NEWLINE
+ "borg.fooPart.exclude.OtherService" + NEWLINE,
xformedContent);
} finally {
jarFile.close();
}
Expand Down