From ce8a166a11ddc9b4c77d7d3f0c9bd61bbfdd5bcd Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 21 Oct 2012 19:57:51 +0200 Subject: [PATCH] pmd: #1031 false DontImportJavaLang --- pmd/etc/changelog.txt | 1 + .../lang/java/rule/imports/DontImportJavaLangRule.java | 3 ++- .../lang/java/rule/imports/xml/DontImportJavaLang.xml | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index ad60be0834..fca42741ab 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -41,6 +41,7 @@ Fixed bug 1025: Regression of Crash in PMDTask due to multithreading (Eclipse an Fixed bug 1017: Type resolution very slow for big project. Thanks to Roman for the patch. Fixed bug 1036: Documentation: default threshold values removed from v5.0 Fixed bug 1035: UseObjectForClearerAPI has misspelled message +Fixed bug 1031: false DontImportJavaLang Improved JSP parser to be less strict with not valid XML documents (like HTML). Thanks to Victor Bucutea. Fixed bgastviewer not working. Thanks to Victor Bucutea. diff --git a/pmd/src/main/java/net/sourceforge/pmd/lang/java/rule/imports/DontImportJavaLangRule.java b/pmd/src/main/java/net/sourceforge/pmd/lang/java/rule/imports/DontImportJavaLangRule.java index 91d646faeb..8a5f5d393d 100644 --- a/pmd/src/main/java/net/sourceforge/pmd/lang/java/rule/imports/DontImportJavaLangRule.java +++ b/pmd/src/main/java/net/sourceforge/pmd/lang/java/rule/imports/DontImportJavaLangRule.java @@ -23,7 +23,8 @@ public class DontImportJavaLangRule extends AbstractJavaRule { if (img.startsWith("java.lang")) { if (img.startsWith("java.lang.ref") || img.startsWith("java.lang.reflect") || img.startsWith("java.lang.annotation") || img.startsWith("java.lang.instrument") - || img.startsWith("java.lang.management") || img.startsWith("java.lang.Thread.")) { + || img.startsWith("java.lang.management") || img.startsWith("java.lang.Thread.") + || img.startsWith("java.lang.ProcessBuilder.")) { return data; } addViolation(data, node); diff --git a/pmd/src/test/resources/net/sourceforge/pmd/lang/java/rule/imports/xml/DontImportJavaLang.xml b/pmd/src/test/resources/net/sourceforge/pmd/lang/java/rule/imports/xml/DontImportJavaLang.xml index f9948248cc..619728dbaf 100644 --- a/pmd/src/test/resources/net/sourceforge/pmd/lang/java/rule/imports/xml/DontImportJavaLang.xml +++ b/pmd/src/test/resources/net/sourceforge/pmd/lang/java/rule/imports/xml/DontImportJavaLang.xml @@ -55,4 +55,13 @@ import java.lang.Thread.UncaughtExceptionHandler; public class Foo {} ]]> + + import java.lang.ProcessBuilder.Redirect: #1031 false DontImportJavaLang + 0 + +