update to 4.2.1 and fixed some deprecations

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6048 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Radim Kubacki
2008-04-22 06:46:01 +00:00
parent 74dba06639
commit 77f36ceac0
11 changed files with 63 additions and 51 deletions

View File

@ -1,3 +1,6 @@
Version 2.2.1
- Updated pmd to version 4.2.1
Version 2.1
- Updated pmd to version 4.1
- [ 1726614 ] javahelp added

View File

@ -2,9 +2,9 @@
<import file="nbproject/build-impl.xml"/>
<property name="pmd.jar" value="pmd-4.1.jar"/>
<property name="pmd.jar" value="pmd-4.2.1.jar"/>
<property name="nb.version" value="netbeans60"/>
<property name="VERSION" value="2.1"/>
<property name="VERSION" value="2.2.1"/>
<property file="build.ant.properties"/>

View File

@ -1,10 +1,10 @@
---++ BUILDING
The NetBeans IDE version 6.0rc1 is currently used for the development of plugin.
The NetBeans IDE version 6.0.1 is currently used for the development of plugin.
Older version of harness (NB5.5) can fail to run tests.
Read the documentation of this support to get details about the
configuration. Basically it tries to find Java platform called 'JDK 1.5' and
NetBeans platform named 'NetBeans IDE 6.0'
Released plugin versions are built with JDK 1.5 and against NetBeans6.0.
Released plugin versions are built with JDK 1.5 and against NetBeans 6.0.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module-Specification-Version: 2.1
OpenIDE-Module-Specification-Version: 2.2.1
Created-By: Ole-Martin Mørk and Gunnlaugur Þór Briem, Radim Kubacki, Tomasz Slota
OpenIDE-Module: pmd
OpenIDE-Module-Layer: pmd/mf-layer.xml

View File

@ -1,5 +1,5 @@
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=1a1e84fd
nbproject/build-impl.xml.data.CRC32=9413c46e
nbproject/build-impl.xml.script.CRC32=209b78c0
nbproject/build-impl.xml.stylesheet.CRC32=deb65f65

View File

@ -1,6 +1,6 @@
extra.module.files=\
modules/ext/jaxen-1.1.1.jar \
modules/ext/pmd-4.1.jar \
modules/ext/pmd-4.2.1.jar \
modules/ext/asm-3.1.jar \
modules/ext/nbpmdrules.jar
javac.compilerargs=-Xlint:unchecked

View File

@ -17,8 +17,8 @@
<binary-origin>lib/jaxen-1.1.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/pmd-4.1.jar</runtime-relative-path>
<binary-origin>lib/pmd-4.1.jar</binary-origin>
<runtime-relative-path>ext/pmd-4.2.1.jar</runtime-relative-path>
<binary-origin>lib/pmd-4.2.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<!-- Deployed path, relative to dir containing module: -->
@ -189,7 +189,7 @@
<public-packages/>
<extra-compilation-unit>
<package-root>libsrc</package-root>
<classpath>lib/pmd-4.1.jar</classpath>
<classpath>lib/pmd-4.2.1.jar</classpath>
<built-to>build/libclasses</built-to>
<built-to>${cluster}/modules/ext/nbpmdrules.jar</built-to>
</extra-compilation-unit>

View File

@ -33,44 +33,42 @@ import net.sourceforge.pmd.PMDException;
*/
public class Fault implements Comparable<Fault> {
private int line;
private String clazz;
private String message;
private final int line;
private final String clazz;
private final String message;
/**
* Creates a new instance of Fault
*
* @param line the line of the fault
* @param clazz the class of the fault
* @param message the pmd message
*/
public Fault(int line, String clazz, String message) {
this.line = line;
this.message = message;
this.clazz = clazz;
}
/**
* Creates a new instance of Fault
*
* @param line the line of the fault
* @param clazz the class of the fault
* @param message the pmd message
*/
public Fault( int line, String clazz, String message ) {
this.line = line;
this.message = message;
this.clazz = clazz;
}
/**
* Creates a new instance of Fault
*
* @param line the line of the fault
* @param clazz the class of the fault
* @param exception the PMD exception on which the fault is based, not null
*/
public Fault( int line, String clazz, PMDException exception ) {
this.line = line;
Exception reason = exception.getReason();
if(reason == null) {
this.message = exception.getMessage();
} else if(reason.getMessage() == null) {
this.message = exception.getMessage() + "; " + reason.toString();
} else {
this.message = exception.getMessage() + "; " + reason.getMessage();
}
this.clazz = clazz;
}
/**
* Creates a new instance of Fault
*
* @param line the line of the fault
* @param clazz the class of the fault
* @param exception the PMD exception on which the fault is based, not null
*/
public Fault(int line, String clazz, PMDException exception) {
this.line = line;
Throwable reason = exception.getCause();
if (reason == null) {
this.message = exception.getMessage();
} else if (reason.getMessage() == null) {
this.message = exception.getMessage() + "; " + reason.toString();
} else {
this.message = exception.getMessage() + "; " + reason.getMessage();
}
this.clazz = clazz;
}
/**

View File

@ -45,6 +45,17 @@ import pmd.config.ConfigUtils;
*/
public class RuleEnabler extends JPanel implements TableModelListener {
private static String join(String delim, Iterable<String> it) {
StringBuilder sb = new StringBuilder();
for (String item: it) {
if (sb.length() > 0) {
sb.append(delim);
}
sb.append(item);
}
return sb.toString();
}
private final PropertyEditorSupport editor;
private String currentRuleName = null;
@ -432,8 +443,8 @@ public class RuleEnabler extends JPanel implements TableModelListener {
*/
private void updateTexts(Rule rule) {
if( rule != null ) {
String exampleText = rule.getExample() != null?
rule.getExample().trim():
String exampleText = rule.getExamples() != null?
join("\n", rule.getExamples()):
"";
example.setText( exampleText );
example.setCaretPosition( 0 );
@ -525,9 +536,9 @@ public class RuleEnabler extends JPanel implements TableModelListener {
Object rules[] = availableList.getSelectedValues();
if( rules != null ) {
RulesConfig data = (RulesConfig)editor.getValue();
List/*<Rule>*/ l = ConfigUtils.createRuleList( data.getRules(), data.getProperties() );
for( int i = 0; i < rules.length; i++ ) {
l.add (rules[i]);
List<Rule> l = ConfigUtils.createRuleList( data.getRules(), data.getProperties() );
for(Object r: rules) {
l.add ((Rule)r);
}
Collections.sort(l, new RuleComparator());
editor.setValue( new RulesConfig(ConfigUtils.getValueAsText(l), data.getProperties()));