Merge branch 'master' of https://github.com/hooperbloob/pmd into hooperbloob-master
This commit is contained in:
commit
6fb192e584
19 files changed
+167
-230
No files matched your search
@@ -1,6 +1,6 @@
|
||||
Change log for the PMD Eclipse plugin
|
||||
|
||||
v4.0.0 - xxx 2011?
|
||||
v4.0.0 - Nov 2012
|
||||
. New integrated AST View and XPath test area
|
||||
. New rule creation wizard
|
||||
. New report preferences panel
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 1997-2009, PMD for Eclipse Development Team
|
||||
Copyright (c) 1997-2012, PMD for Eclipse Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -11,7 +11,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* The end-user documentation included with the redistribution, if
|
||||
any, must include the following acknowledgement:
|
||||
any, must include the following acknowledgment:
|
||||
"This product includes software developed in part by support from
|
||||
the Defense Advanced Research Project Agency (DARPA)"
|
||||
* Neither the name of "PMD for Eclipse Development Team" nor the names of its
|
||||
|
||||
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %plugin.name
|
||||
Bundle-SymbolicName: net.sourceforge.pmd.eclipse.plugin;singleton:=true
|
||||
Bundle-Version: 5.0.0.v20100826
|
||||
Bundle-Version: 4.0.0.qualifier
|
||||
Bundle-Activator: net.sourceforge.pmd.eclipse.plugin.PMDPlugin
|
||||
Require-Bundle: org.apache.commons.logging;bundle-version="1.0.4",
|
||||
org.eclipse.core.resources,
|
||||
@@ -15,8 +15,7 @@ Require-Bundle: org.apache.commons.logging;bundle-version="1.0.4",
|
||||
org.eclipse.team.core,
|
||||
org.eclipse.search,
|
||||
org.eclipse.help,
|
||||
org.eclipse.help.ui,
|
||||
org.eclipse.help.appserver
|
||||
org.eclipse.help.ui
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-Vendor: %plugin.provider
|
||||
@@ -27,7 +26,7 @@ Bundle-ClassPath: lib/asm-3.2.jar,
|
||||
lib/log4j-1.2.15.jar,
|
||||
lib/saxon9.jar,
|
||||
lib/js-cvs-12122009.jar,
|
||||
lib/pmd-5.0.jar,
|
||||
lib/pmd-5.1.0-SNAPSHOT.jar,
|
||||
lib/xercesImpl-2.6.2.jar,
|
||||
lib/xmlParserAPIs-2.6.2.jar,
|
||||
pmd-plugin.jar,
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
Release notes for the PMD Eclipse Plugin
|
||||
|
||||
v4.0.0 - November 8 2012
|
||||
|
||||
Numerous changes & bugfixes
|
||||
Latest 5.0.1 snapshot of PMD itself
|
||||
Compatibility with Eclipse Juno
|
||||
|
||||
----------------------------------------
|
||||
v3.2.5 - October 13 2008
|
||||
------------------------
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
aboutText=(c) 1997-2009 PMD Team
|
||||
featureImage=icons/pmd-icon-32.gif
|
||||
aboutText=(c) 1997-2012 PMD Team
|
||||
|
||||
featureImage=icons/pmd-icon-32.gif
|
||||
|
||||
welcomePage=$nl$/welcome.xml
|
||||
@@ -6,7 +6,7 @@ bin.includes = META-INF/,\
|
||||
lib/jaxen-1.1.1.jar,\
|
||||
lib/junit.jar,\
|
||||
lib/log4j-1.2.15.jar,\
|
||||
lib/pmd-5.0.jar,\
|
||||
lib/pmd-5.1.0-SNAPSHOT.jar,\
|
||||
lib/xercesImpl-2.6.2.jar,\
|
||||
lib/xmlParserAPIs-2.6.2.jar,\
|
||||
messages.properties,\
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
@@ -590,7 +590,7 @@
|
||||
<decorator
|
||||
adaptable="true"
|
||||
class="net.sourceforge.pmd.eclipse.ui.RuleLabelDecorator"
|
||||
icon="icons/sample_decorator.gif"
|
||||
icon="icons/warn.gif"
|
||||
id="net.sourceforge.pmd.eclipse.plugin.RuleLabelDecorator"
|
||||
label="Rule Violation Decorator"
|
||||
lightweight="true"
|
||||
|
||||
+4
-1
@@ -4,6 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import name.herlin.command.CommandException;
|
||||
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
|
||||
import net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
@@ -11,6 +12,7 @@ import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
@@ -79,10 +81,11 @@ public class FileChangeReviewer implements IResourceChangeListener {
|
||||
if (itemsChanged.isEmpty()) return;
|
||||
|
||||
ReviewCodeCmd cmd = new ReviewCodeCmd(); // separate one for each thread
|
||||
cmd.clearExistingMarkersBeforeApplying(true);
|
||||
cmd.reset();
|
||||
|
||||
for (ResourceChange chg : itemsChanged) cmd.addResource(chg.file);
|
||||
|
||||
|
||||
try {
|
||||
cmd.performExecute();
|
||||
} catch (CommandException e) {
|
||||
|
||||
+3
-2
@@ -10,7 +10,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.pmd.Configuration;
|
||||
import net.sourceforge.pmd.PMDConfiguration;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.RuleSetFactory;
|
||||
import net.sourceforge.pmd.RuleSetNotFoundException;
|
||||
@@ -110,7 +110,7 @@ public class PMDPlugin extends AbstractUIPlugin {
|
||||
return color;
|
||||
}
|
||||
|
||||
public static void setJavaClassLoader(Configuration config, IJavaProject javaProject) {
|
||||
public static void setJavaClassLoader(PMDConfiguration config, IJavaProject javaProject) {
|
||||
|
||||
IPreferences preferences = getDefault().loadPreferences();
|
||||
if (preferences.isProjectBuildPathEnabled()) {
|
||||
@@ -450,6 +450,7 @@ public class PMDPlugin extends AbstractUIPlugin {
|
||||
*
|
||||
*/
|
||||
private void registerStandardRuleSets() {
|
||||
|
||||
final RuleSetFactory factory = new RuleSetFactory();
|
||||
try {
|
||||
Iterator<RuleSet> iterator = factory.getRegisteredRuleSets();
|
||||
|
||||
+4
-4
@@ -37,8 +37,8 @@ import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import name.herlin.command.Timer;
|
||||
import net.sourceforge.pmd.Configuration;
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.PMDConfiguration;
|
||||
import net.sourceforge.pmd.PMDException;
|
||||
import net.sourceforge.pmd.Rule;
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
@@ -82,11 +82,11 @@ public class BaseVisitor {
|
||||
private IProjectProperties projectProperties;
|
||||
protected RuleSet hiddenRules;
|
||||
|
||||
private Configuration configuration;
|
||||
private PMDConfiguration configuration;
|
||||
|
||||
|
||||
protected Configuration configuration() {
|
||||
if (configuration == null) configuration = new Configuration();
|
||||
protected PMDConfiguration configuration() {
|
||||
if (configuration == null) configuration = new PMDConfiguration();
|
||||
return configuration;
|
||||
}
|
||||
/**
|
||||
|
||||
+12
-1
@@ -45,6 +45,7 @@ import java.util.List;
|
||||
|
||||
import name.herlin.command.CommandException;
|
||||
import net.sourceforge.pmd.cpd.CPD;
|
||||
import net.sourceforge.pmd.cpd.CPDConfiguration;
|
||||
import net.sourceforge.pmd.cpd.Language;
|
||||
import net.sourceforge.pmd.cpd.LanguageFactory;
|
||||
import net.sourceforge.pmd.cpd.Match;
|
||||
@@ -245,7 +246,8 @@ public class DetectCutAndPasteCmd extends AbstractProjectCommand {
|
||||
*/
|
||||
private CPD detectCutAndPaste(final List<File> files) {
|
||||
log.debug("Searching for project files");
|
||||
final CPD cpd = new CPD(minTileSize, language);
|
||||
|
||||
final CPD cpd = newCPD();
|
||||
|
||||
subTask("Collecting files for CPD");
|
||||
final Iterator<File> fileIterator = files.iterator();
|
||||
@@ -268,6 +270,15 @@ public class DetectCutAndPasteCmd extends AbstractProjectCommand {
|
||||
|
||||
return cpd;
|
||||
}
|
||||
|
||||
private CPD newCPD() {
|
||||
CPDConfiguration config = new CPDConfiguration(
|
||||
minTileSize,
|
||||
language,
|
||||
System.getProperty("file.encoding")
|
||||
);
|
||||
return new CPD(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a report using the matches of the CPD. Creates a report folder
|
||||
|
||||
+106
-104
@@ -38,7 +38,8 @@ package net.sourceforge.pmd.eclipse.runtime.cmd;
|
||||
|
||||
import net.sourceforge.pmd.Rule;
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
import net.sourceforge.pmd.lang.rule.AbstractRuleViolation;
|
||||
import net.sourceforge.pmd.lang.ast.Node;
|
||||
import net.sourceforge.pmd.lang.rule.ParametricRuleViolation;
|
||||
|
||||
/**
|
||||
* This is an implementation of IRuleViolation.
|
||||
@@ -49,18 +50,19 @@ import net.sourceforge.pmd.lang.rule.AbstractRuleViolation;
|
||||
* @author Brian Remedios
|
||||
*/
|
||||
|
||||
class FakeRuleViolation extends AbstractRuleViolation {
|
||||
// private String filename = "";
|
||||
// private int beginLine;
|
||||
// private int beginColumn;
|
||||
// private int endLine;
|
||||
// private int endColumn;
|
||||
// private Rule rule;
|
||||
// private String description = "";
|
||||
// private String packageName = "";
|
||||
// private String methodName = "";
|
||||
// private String className = "";
|
||||
// private String variableName = "";
|
||||
class FakeRuleViolation extends ParametricRuleViolation<Node> {
|
||||
|
||||
private String filename = "";
|
||||
private int beginLine;
|
||||
private int beginColumn;
|
||||
private int endLine;
|
||||
private int endColumn;
|
||||
private Rule rule;
|
||||
private String description = "";
|
||||
private String packageName = "";
|
||||
private String methodName = "";
|
||||
private String className = "";
|
||||
private String variableName = "";
|
||||
|
||||
private static final RuleContext DummyContext = new RuleContext();
|
||||
|
||||
@@ -73,97 +75,97 @@ class FakeRuleViolation extends AbstractRuleViolation {
|
||||
super(theRule, DummyContext, null, null);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getFilename()
|
||||
// */
|
||||
// public String getFilename() {
|
||||
// return filename;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getBeginLine()
|
||||
// */
|
||||
// public int getBeginLine() {
|
||||
// return beginLine;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getBeginColumn()
|
||||
// */
|
||||
// public int getBeginColumn() {
|
||||
// return beginColumn;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getEndLine()
|
||||
// */
|
||||
// public int getEndLine() {
|
||||
// return endLine;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getEndColumn()
|
||||
// */
|
||||
// public int getEndColumn() {
|
||||
// return endColumn;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getRule()
|
||||
// */
|
||||
// public Rule getRule() {
|
||||
// return rule;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getDescription()
|
||||
// */
|
||||
// public String getDescription() {
|
||||
// return description;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getPackageName()
|
||||
// */
|
||||
// public String getPackageName() {
|
||||
// return packageName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getMethodName()
|
||||
// */
|
||||
// public String getMethodName() {
|
||||
// return methodName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getClassName()
|
||||
// */
|
||||
// public String getClassName() {
|
||||
// return className;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#isSuppressed()
|
||||
// */
|
||||
// public boolean isSuppressed() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see net.sourceforge.pmd.IRuleViolation#getVariableName()
|
||||
// */
|
||||
// public String getVariableName() {
|
||||
// return variableName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param beginColumn The beginColumn to set.
|
||||
// */
|
||||
// public void setBeginColumn(int beginColumn) {
|
||||
// this.beginColumn = beginColumn;
|
||||
// }
|
||||
//
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getFilename()
|
||||
*/
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getBeginLine()
|
||||
*/
|
||||
public int getBeginLine() {
|
||||
return beginLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getBeginColumn()
|
||||
*/
|
||||
public int getBeginColumn() {
|
||||
return beginColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getEndLine()
|
||||
*/
|
||||
public int getEndLine() {
|
||||
return endLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getEndColumn()
|
||||
*/
|
||||
public int getEndColumn() {
|
||||
return endColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getRule()
|
||||
*/
|
||||
public Rule getRule() {
|
||||
return rule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getDescription()
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getPackageName()
|
||||
*/
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getMethodName()
|
||||
*/
|
||||
public String getMethodName() {
|
||||
return methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getClassName()
|
||||
*/
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#isSuppressed()
|
||||
*/
|
||||
public boolean isSuppressed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.sourceforge.pmd.IRuleViolation#getVariableName()
|
||||
*/
|
||||
public String getVariableName() {
|
||||
return variableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param beginColumn The beginColumn to set.
|
||||
*/
|
||||
public void setBeginColumn(int beginColumn) {
|
||||
this.beginColumn = beginColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param beginLine The beginLine to set.
|
||||
*/
|
||||
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
package net.sourceforge.pmd.eclipse.runtime.cmd;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.Configuration;
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.PMDException;
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.RuleSetFactory;
|
||||
import net.sourceforge.pmd.RuleSets;
|
||||
import net.sourceforge.pmd.lang.LanguageVersion;
|
||||
import net.sourceforge.pmd.renderers.Renderer;
|
||||
import net.sourceforge.pmd.util.datasource.DataSource;
|
||||
import net.sourceforge.pmd.util.datasource.FileDataSource;
|
||||
|
||||
/**
|
||||
* Temporary class to handle PMD 4.2.x compatibility issues.
|
||||
*
|
||||
* This should be removed once the Configuration class is working in PMD 5.0.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class PMDEngine {
|
||||
|
||||
private Configuration configuration = new Configuration();
|
||||
|
||||
public void setLanguageVersion(LanguageVersion languageVersion) {
|
||||
configuration.setDefaultLanguageVersion(languageVersion);
|
||||
}
|
||||
|
||||
public void setClassLoader(ClassLoader classLoader) {
|
||||
configuration.setClassLoader(classLoader);
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoader() {
|
||||
return configuration.getClassLoader();
|
||||
}
|
||||
|
||||
public boolean applies(File file, RuleSet ruleSet) {
|
||||
return ruleSet.applies(file);
|
||||
}
|
||||
|
||||
// public void processFile(Reader input, RuleSet ruleSet, RuleContext context) throws PMDException {
|
||||
// RuleSets set = new RuleSets();
|
||||
// set.addRuleSet(ruleSet);
|
||||
//
|
||||
// PMD pmd = new PMD(configuration);
|
||||
// pmd.processFile(input, set, context);
|
||||
// }
|
||||
|
||||
public void processFile(File file, RuleSet ruleSet, RuleContext context) throws PMDException {
|
||||
|
||||
process(new FileDataSource(file), ruleSet, context);
|
||||
}
|
||||
|
||||
public void process(DataSource dataSource, RuleSet ruleSet, RuleContext context) throws PMDException {
|
||||
|
||||
RuleSets set = new RuleSets(ruleSet);
|
||||
|
||||
List<DataSource> files = new ArrayList<DataSource>(1);
|
||||
files.add(dataSource);
|
||||
|
||||
PMD.processFiles(configuration, new RuleSetFactory(), files, context, new ArrayList<Renderer>());
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -49,6 +49,7 @@ import net.sourceforge.pmd.Rule;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
|
||||
import net.sourceforge.pmd.eclipse.runtime.PMDRuntimeConstants;
|
||||
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
|
||||
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences;
|
||||
import net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties;
|
||||
import net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException;
|
||||
@@ -99,6 +100,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
private int ruleCount;
|
||||
private int fileCount;
|
||||
private long pmdDuration;
|
||||
private boolean clearExistingMarkersBeforeApplying;
|
||||
private String onErrorIssue = null;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -116,6 +118,10 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
setTerminated(false);
|
||||
}
|
||||
|
||||
public void clearExistingMarkersBeforeApplying(boolean flag) {
|
||||
clearExistingMarkersBeforeApplying = flag;
|
||||
}
|
||||
|
||||
public Set<IFile> markedFiles() {
|
||||
return markersByFile.keySet();
|
||||
}
|
||||
@@ -523,7 +529,11 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
currentFile = file.getName();
|
||||
|
||||
Set<MarkerInfo2> markerInfoSet = markersByFile.get(file);
|
||||
// MarkerUtil.deleteAllMarkersIn(file);
|
||||
|
||||
if (clearExistingMarkersBeforeApplying) {
|
||||
MarkerUtil.deleteAllMarkersIn(file);
|
||||
}
|
||||
|
||||
for (MarkerInfo2 markerInfo : markerInfoSet) {
|
||||
markerInfo.addAsMarkerTo(file);
|
||||
violationCount++;
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import name.herlin.command.CommandException;
|
||||
import net.sourceforge.pmd.Configuration;
|
||||
import net.sourceforge.pmd.PMDConfiguration;
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.PMDException;
|
||||
import net.sourceforge.pmd.Rule;
|
||||
@@ -133,7 +133,7 @@ public class ReviewResourceForRuleCommand extends AbstractDefaultCommand {
|
||||
// Reader input = new InputStreamReader(file.getContents(), file.getCharset());
|
||||
RuleSets rSets = new RuleSets(ruleSet);
|
||||
|
||||
new SourceCodeProcessor(new Configuration()).processSourceCode(file.getContents(), rSets, context);
|
||||
new SourceCodeProcessor(new PMDConfiguration()).processSourceCode(file.getContents(), rSets, context);
|
||||
// input.close();
|
||||
// } catch (CoreException e) {
|
||||
// throw new CommandException(e);
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.Configuration;
|
||||
import net.sourceforge.pmd.PMDConfiguration;
|
||||
import net.sourceforge.pmd.PMDException;
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
@@ -311,7 +311,7 @@ public abstract class AbstractStructureInspectorPage extends Page implements IPr
|
||||
InputStream input = new ByteArrayInputStream(bytes);
|
||||
|
||||
RuleSets rSets = new RuleSets(rs);
|
||||
new SourceCodeProcessor(new Configuration()).processSourceCode(input, rSets, ctx);
|
||||
new SourceCodeProcessor(new PMDConfiguration()).processSourceCode(input, rSets, ctx);
|
||||
|
||||
// the Rule then can give us the Methods
|
||||
methodList.addAll(dfaGraphRule.getMethods());
|
||||
|
||||
+4
-34
@@ -1,10 +1,7 @@
|
||||
package net.sourceforge.pmd.eclipse.util;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -14,39 +11,12 @@ public class IOUtil {
|
||||
|
||||
private IOUtil() {}
|
||||
|
||||
public static void closeQuietly(OutputStream stream) {
|
||||
if (stream == null) return;
|
||||
public static void closeQuietly(Closeable closeable) {
|
||||
if (closeable == null) return;
|
||||
try {
|
||||
stream.close();
|
||||
closeable.close();
|
||||
} catch (IOException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(InputStream stream) {
|
||||
if (stream == null) return;
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Writer writer) {
|
||||
if (writer == null) return;
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException ex) {
|
||||
// ignore it
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Reader reader) {
|
||||
if (reader == null) return;
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user