diff --git a/pom.xml b/pom.xml
index 8fca8d3e..cb10a847 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,6 +78,9 @@
Anthony Dahanne
+
+ Fabiano Cipriano de Oliveira
+
diff --git a/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java b/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java
index b8d624f8..dc0338de 100644
--- a/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java
+++ b/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java
@@ -139,20 +139,6 @@ public void modifyOutputStream( JarOutputStream jos )
while ( ( className = reader.readLine() ) != null )
{
-
- if ( relocators != null )
- {
- for ( Relocator relocator : relocators )
- {
- //if the class can be relocated then relocate it
- if ( relocator.canRelocateClass( className ) )
- {
- className = relocator.applyToSourceContent( className );
- break;
- }
- }
- }
-
writer.println( className );
writer.flush();
}
diff --git a/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java b/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java
index bde428af..fce1c715 100644
--- a/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java
+++ b/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java
@@ -90,6 +90,50 @@ public void relocatedClasses() throws Exception {
tempJar.delete();
}
}
+
+ @Test
+ public void concatanationAppliedMultipleTimes() throws Exception {
+ SimpleRelocator relocator =
+ new SimpleRelocator( "org.eclipse", "org.eclipse1234", null, null );
+ List relocators = Lists.newArrayList( relocator );
+
+ String content = "org.eclipse.osgi.launch.EquinoxFactory\n";
+ byte[] contentBytes = content.getBytes( "UTF-8" );
+ InputStream contentStream = new ByteArrayInputStream( contentBytes );
+ String contentResource = "META-INF/services/org.osgi.framework.launch.FrameworkFactory";
+
+ ServicesResourceTransformer xformer = new ServicesResourceTransformer();
+ xformer.processResource( contentResource, contentStream, relocators );
+ contentStream.close();
+
+ File tempJar = File.createTempFile("shade.", ".jar");
+ tempJar.deleteOnExit();
+ FileOutputStream fos = new FileOutputStream( tempJar );
+ JarOutputStream jos = new JarOutputStream( fos );
+ try {
+ xformer.modifyOutputStream( jos );
+ jos.close();
+ jos = null;
+ JarFile jarFile = new JarFile( tempJar );
+ JarEntry jarEntry = jarFile.getJarEntry( contentResource );
+ assertNotNull( jarEntry );
+ InputStream entryStream = jarFile.getInputStream( jarEntry );
+ try {
+ String xformedContent = IOUtils.toString(entryStream, "utf-8");
+ assertEquals( "org.eclipse1234.osgi.launch.EquinoxFactory" + System.getProperty( "line.separator" ), xformedContent );
+
+ } finally {
+ IOUtils.closeQuietly( entryStream );
+ jarFile.close();
+ }
+ } finally {
+ if (jos != null)
+ {
+ IOUtils.closeQuietly( jos );
+ }
+ tempJar.delete();
+ }
+ }
@Test
public void concatenation() throws Exception {