diff --git a/pmd-netbeans/CHANGES.txt b/pmd-netbeans/CHANGES.txt index 3b05aa48c1..ae359ea522 100644 --- a/pmd-netbeans/CHANGES.txt +++ b/pmd-netbeans/CHANGES.txt @@ -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 diff --git a/pmd-netbeans/build.xml b/pmd-netbeans/build.xml index 6b48a9bee0..0485f8edb4 100644 --- a/pmd-netbeans/build.xml +++ b/pmd-netbeans/build.xml @@ -2,9 +2,9 @@ - + - + diff --git a/pmd-netbeans/lib/BUILDING.txt b/pmd-netbeans/lib/BUILDING.txt index 54475d0525..03a3e5fdae 100644 --- a/pmd-netbeans/lib/BUILDING.txt +++ b/pmd-netbeans/lib/BUILDING.txt @@ -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. diff --git a/pmd-netbeans/lib/pmd-4.1.jar b/pmd-netbeans/lib/pmd-4.1.jar deleted file mode 100644 index 3543cedfd9..0000000000 Binary files a/pmd-netbeans/lib/pmd-4.1.jar and /dev/null differ diff --git a/pmd-netbeans/lib/pmd-4.2.1.jar b/pmd-netbeans/lib/pmd-4.2.1.jar new file mode 100644 index 0000000000..9ad00d60ae Binary files /dev/null and b/pmd-netbeans/lib/pmd-4.2.1.jar differ diff --git a/pmd-netbeans/manifest.mf b/pmd-netbeans/manifest.mf index 402611c478..fe154b6ac8 100644 --- a/pmd-netbeans/manifest.mf +++ b/pmd-netbeans/manifest.mf @@ -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 diff --git a/pmd-netbeans/nbproject/genfiles.properties b/pmd-netbeans/nbproject/genfiles.properties index ca8031471f..1821d5a302 100644 --- a/pmd-netbeans/nbproject/genfiles.properties +++ b/pmd-netbeans/nbproject/genfiles.properties @@ -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 diff --git a/pmd-netbeans/nbproject/project.properties b/pmd-netbeans/nbproject/project.properties index 46c1d26411..a9d9b70596 100644 --- a/pmd-netbeans/nbproject/project.properties +++ b/pmd-netbeans/nbproject/project.properties @@ -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 diff --git a/pmd-netbeans/nbproject/project.xml b/pmd-netbeans/nbproject/project.xml index 9e9efe1607..b84909813e 100644 --- a/pmd-netbeans/nbproject/project.xml +++ b/pmd-netbeans/nbproject/project.xml @@ -17,8 +17,8 @@ lib/jaxen-1.1.1.jar - ext/pmd-4.1.jar - lib/pmd-4.1.jar + ext/pmd-4.2.1.jar + lib/pmd-4.2.1.jar @@ -189,7 +189,7 @@ libsrc - lib/pmd-4.1.jar + lib/pmd-4.2.1.jar build/libclasses ${cluster}/modules/ext/nbpmdrules.jar diff --git a/pmd-netbeans/src/pmd/Fault.java b/pmd-netbeans/src/pmd/Fault.java index 26d054be06..f780c0f0da 100644 --- a/pmd-netbeans/src/pmd/Fault.java +++ b/pmd-netbeans/src/pmd/Fault.java @@ -33,44 +33,42 @@ import net.sourceforge.pmd.PMDException; */ public class Fault implements Comparable { - 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; + } /** diff --git a/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java b/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java index 40c815baba..33684f3c7d 100644 --- a/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java +++ b/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java @@ -45,6 +45,17 @@ import pmd.config.ConfigUtils; */ public class RuleEnabler extends JPanel implements TableModelListener { + private static String join(String delim, Iterable 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/**/ l = ConfigUtils.createRuleList( data.getRules(), data.getProperties() ); - for( int i = 0; i < rules.length; i++ ) { - l.add (rules[i]); + List 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()));