Skip to content

Commit

Permalink
Remove deprecated usages
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed May 20, 2023
1 parent 72969c7 commit 01e30a6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public boolean isExcludedFromFailure(final RuleViolation errorDetail) {
throw new RuntimeException(e2);
}
}
final String className = extractClassName(errorDetail.getPackageName(), errorDetail.getClassName(), fileName);
final Map<String, String> additionalInfo = errorDetail.getAdditionalInfo();
final String className = extractClassName(
additionalInfo.get(RuleViolation.PACKAGE_NAME), additionalInfo.get(RuleViolation.CLASS_NAME), fileName);
return isExcludedFromFailure(className, errorDetail.getRule().getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ private PmdResult run() throws MavenReportException {

PMDConfiguration configuration = new PMDConfiguration();
LanguageVersion languageVersion = null;
Language language = LanguageRegistry.findLanguageByTerseName(
request.getLanguage() != null ? request.getLanguage() : "java");
Language language =
LanguageRegistry.PMD.getLanguageById(request.getLanguage() != null ? request.getLanguage() : "java");
if (language == null) {
throw new MavenReportException("Unsupported language: " + request.getLanguage());
}
Expand Down Expand Up @@ -189,9 +189,6 @@ private PmdResult run() throws MavenReportException {

configuration.setRuleSets(request.getRulesets());
configuration.setMinimumPriority(RulePriority.valueOf(request.getMinimumPriority()));
if (request.getBenchmarkOutputLocation() != null) {
configuration.setBenchmark(true);
}
List<File> files = request.getFiles();

Report report = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
import java.net.URL;
import java.net.URLClassLoader;

import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Test;

public class ExecutorTest extends TestCase {
import static org.junit.Assert.assertEquals;

public class ExecutorTest {
@Test
public void testBuildClasspath() throws MalformedURLException {
String basename = "home/test/dir with space/mylib.jar";
String pathname = new File("/", basename).getPath();
Expand All @@ -39,6 +41,6 @@ public void testBuildClasspath() throws MalformedURLException {

StringBuilder classpath = new StringBuilder();
Executor.buildClasspath(classpath, mockedClassLoader);
Assert.assertEquals(pathname + File.pathSeparator, classpath.toString());
assertEquals(pathname + File.pathSeparator, classpath.toString());
}
}

0 comments on commit 01e30a6

Please sign in to comment.