diff --git a/pmd-netbeans/CHANGES.txt b/pmd-netbeans/CHANGES.txt index 7c98db9409..f9492d9588 100644 --- a/pmd-netbeans/CHANGES.txt +++ b/pmd-netbeans/CHANGES.txt @@ -1,4 +1,6 @@ -- fixed NPE when scanning is on (http://www.netbeans.org/issues/show_bug.cgi?id=72017) +- fixed some bugs + http://www.netbeans.org/issues/show_bug.cgi?id=72017 + http://www.netbeans.org/issues/show_bug.cgi?id=72215 Version 1.5 - Updated pmd to version 3.5 diff --git a/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java b/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java index 1e7d2619c2..ddb9b1f637 100644 --- a/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java +++ b/pmd-netbeans/src/pmd/config/ui/RuleEnabler.java @@ -432,24 +432,26 @@ public class RuleEnabler extends JPanel implements TableModelListener { } }//GEN-LAST:event_availableListMouseClicked - /** - * Update text of example and information fields, and rule properties. - */ - private void updateTexts(Rule rule) { - if( rule != null ) { - String exampleText = REGEX.substitute( REGEX_EXAMPLE, rule.getExample() ); - if (exampleText.startsWith( "\n" )) { - // Probably REGEX_EXAMPLE should have taken care of this, but it did not?! - exampleText = exampleText.substring( 1 ); - } - example.setText( exampleText ); - example.setCaretPosition( 0 ); - information.setText( REGEX.substitute( REGEX_INFORMATION, rule.getDescription().trim() ) ); - information.setCaretPosition( 0 ); - updatePropertiesModel( rule ); - } - } - + /** + * Update text of example and information fields, and rule properties. + */ + private void updateTexts(Rule rule) { + if( rule != null ) { + String exampleText = rule.getExample() != null? + REGEX.substitute( REGEX_EXAMPLE, rule.getExample() ): + ""; + if (exampleText.startsWith( "\n" )) { + // Probably REGEX_EXAMPLE should have taken care of this, but it did not?! + exampleText = exampleText.substring( 1 ); + } + example.setText( exampleText ); + example.setCaretPosition( 0 ); + information.setText( REGEX.substitute( REGEX_INFORMATION, rule.getDescription().trim() ) ); + information.setCaretPosition( 0 ); + updatePropertiesModel( rule ); + } + } + /** Called when the user selects a value in the chosenList * @param evt the event fired */