Skip to content

Commit

Permalink
Fix SpotBugs warnings (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Nov 17, 2022
1 parent 0aa3c25 commit 1ba4418
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 0 additions & 2 deletions injector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<properties>
<asm.version>9.4</asm.version>
<maven-plugin-tools.version>3.7.0</maven-plugin-tools.version>
<!-- TODO fix violations -->
<spotbugs.threshold>High</spotbugs.threshold>
</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public void visitEnd() {
}
}

@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "TODO needs triage")
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "user-provided value for running the program")
public static void main(String[] args) throws IOException {
MethodInjector mi = new MethodInjector();
for (String a : args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
package com.infradna.tool.bridge_method_injector;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
Expand All @@ -48,6 +50,9 @@ public class ProcessMojo extends AbstractMojo {
private File classesDirectory;

@Override
@SuppressFBWarnings(
value = {"DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED", "PATH_TRAVERSAL_IN"},
justification = "irrelevant without SecurityManager; user-provided value for running the program")
public void execute() throws MojoExecutionException {
try {
for (String line : Index.listClassNames(WithBridgeMethods.class, new URLClassLoader(new URL[] {classesDirectory.toURI().toURL()}, ClassLoader.getSystemClassLoader().getParent()))) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.infradna.tool.bridge_method_injector;

import org.junit.Test;

public class Junit4TestsRanTest {

@Test
public void anything() {
/*
* Intentionally blank. We just want a test that runs with JUnit so that buildPlugin() works
* in the Jenkinsfile.
*/
}
}

0 comments on commit 1ba4418

Please sign in to comment.