Skip to content

Commit

Permalink
Add missing @OverRide annotations (#246)
Browse files Browse the repository at this point in the history
* Add missing @OverRide annotations
  • Loading branch information
elharo authored Dec 25, 2024
1 parent 87b3512 commit 3a844d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,25 @@ public class ApacheLicenseResourceTransformer extends AbstractCompatibilityTrans

private static final String LICENSE_MD_PATH = "META-INF/LICENSE.md";

@Override
public boolean canTransformResource(String resource) {
return LICENSE_PATH.equalsIgnoreCase(resource)
|| LICENSE_TXT_PATH.regionMatches(true, 0, resource, 0, LICENSE_TXT_PATH.length())
|| LICENSE_MD_PATH.regionMatches(true, 0, resource, 0, LICENSE_MD_PATH.length());
}

@Override
public void processResource(String resource, InputStream is, List<Relocator> relocators, long time)
throws IOException {
// no op
}

@Override
public boolean hasTransformedResource() {
return false;
}

@Override
public void modifyOutputStream(JarOutputStream os) throws IOException {
// no op
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@ public class ComponentsXmlResourceTransformer extends AbstractCompatibilityTrans

public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml";

@Override
public boolean canTransformResource(String resource) {
return COMPONENTS_XML_PATH.equals(resource);
}

@Override
public void processResource(String resource, InputStream is, List<Relocator> relocators, long time)
throws IOException {
Xpp3Dom newDom;

try {
BufferedInputStream bis = new BufferedInputStream(is) {
@Override
public void close() throws IOException {
// leave ZIP open
}
Expand Down Expand Up @@ -117,6 +120,7 @@ public void close() throws IOException {
}
}

@Override
public void modifyOutputStream(JarOutputStream jos) throws IOException {
JarEntry jarEntry = new JarEntry(COMPONENTS_XML_PATH);
jarEntry.setTime(time);
Expand All @@ -130,6 +134,7 @@ public void modifyOutputStream(JarOutputStream jos) throws IOException {
components.clear();
}

@Override
public boolean hasTransformedResource() {
return !components.isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,19 @@ public class PluginXmlResourceTransformer extends AbstractCompatibilityTransform

public static final String PLUGIN_XML_PATH = "META-INF/maven/plugin.xml";

@Override
public boolean canTransformResource(String resource) {
return PLUGIN_XML_PATH.equals(resource);
}

@Override
public void processResource(String resource, InputStream is, List<Relocator> relocators, long time)
throws IOException {
Xpp3Dom newDom;

try {
BufferedInputStream bis = new BufferedInputStream(is) {
@Override
public void close() throws IOException {
// leave ZIP open
}
Expand Down Expand Up @@ -116,6 +119,7 @@ public void close() throws IOException {
}
}

@Override
public void modifyOutputStream(JarOutputStream jos) throws IOException {
byte[] data = getTransformedResource();

Expand All @@ -128,6 +132,7 @@ public void modifyOutputStream(JarOutputStream jos) throws IOException {
mojos.clear();
}

@Override
public boolean hasTransformedResource() {
return !mojos.isEmpty();
}
Expand Down

0 comments on commit 3a844d0

Please sign in to comment.