From fb426227e400122c573ad943007964e96feaa5d4 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 5 Aug 2013 08:42:44 +0200 Subject: [PATCH] pmd: fix #1114 CPD - Tokenizer not initialized with requested properties There was a similar problem with CPD GUI. Also resetting the properties, so that unchecking the checkboxes has actually an effect. --- pmd/src/main/java/net/sourceforge/pmd/cpd/GUI.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pmd/src/main/java/net/sourceforge/pmd/cpd/GUI.java b/pmd/src/main/java/net/sourceforge/pmd/cpd/GUI.java index 982b395a32..acf9fa9335 100644 --- a/pmd/src/main/java/net/sourceforge/pmd/cpd/GUI.java +++ b/pmd/src/main/java/net/sourceforge/pmd/cpd/GUI.java @@ -574,6 +574,7 @@ public class GUI implements CPDListener { p.setProperty(LanguageFactory.EXTENSION, extensionField.getText()); LanguageConfig conf = languageConfigFor((String)languageBox.getSelectedItem()); Language language = conf.languageFor(new LanguageFactory(), p); + language.setProperties(p); CPDConfiguration config = new CPDConfiguration( Integer.parseInt(minimumLengthField.getText()), language, encodingField.getText() @@ -597,21 +598,19 @@ public class GUI implements CPDListener { t.stop(); matches = new ArrayList(); - Match match; for (Iterator i = cpd.getMatches(); i.hasNext();) { - match = i.next(); + Match match = i.next(); setLabelFor(match); matches.add(match); } + setListDataFrom(cpd.getMatches()); String report = new SimpleRenderer().render(cpd.getMatches()); if (report.length() == 0) { JOptionPane.showMessageDialog(frame, - "Done; couldn't find any duplicates longer than " + minimumLengthField.getText() + " tokens"); + "Done. Couldn't find any duplicates longer than " + minimumLengthField.getText() + " tokens"); } else { resultsTextArea.setText(report); - setListDataFrom(cpd.getMatches()); - } } catch (IOException t) { t.printStackTrace();