From 3386186533e02f7dec95e3390e85620da21bef36 Mon Sep 17 00:00:00 2001
From: Tom Copeland <tomcopeland@users.sourceforge.net>
Date: Thu, 8 Aug 2002 19:49:13 +0000
Subject: [PATCH] fixed bug in CPD directory scanning

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@660 51baf565-9d33-0410-a72c-fc3788e3496d
---
 pmd/src/net/sourceforge/pmd/cpd/CPD.java | 6 ++++--
 pmd/src/net/sourceforge/pmd/cpd/GUI.java | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/pmd/src/net/sourceforge/pmd/cpd/CPD.java b/pmd/src/net/sourceforge/pmd/cpd/CPD.java
index 2d5eff55db..e10f1914cc 100644
--- a/pmd/src/net/sourceforge/pmd/cpd/CPD.java
+++ b/pmd/src/net/sourceforge/pmd/cpd/CPD.java
@@ -73,8 +73,10 @@ public class CPD {
      String[] possibles = dir.list(filter);
      for (int i=0; i<possibles.length; i++) {
         File tmp = new File(dir + System.getProperty("file.separator") + possibles[i]);
-        if (recurse && tmp.isDirectory()) {
-           scanDirectory(tmp, list, true);
+        if (tmp.isDirectory()) {
+            if (recurse) {
+                scanDirectory(tmp, list, true);
+            }
         } else {
            list.add(new File(dir + System.getProperty("file.separator") + possibles[i]));
         }
diff --git a/pmd/src/net/sourceforge/pmd/cpd/GUI.java b/pmd/src/net/sourceforge/pmd/cpd/GUI.java
index 2c40c8ba54..2d6b0527c1 100644
--- a/pmd/src/net/sourceforge/pmd/cpd/GUI.java
+++ b/pmd/src/net/sourceforge/pmd/cpd/GUI.java
@@ -156,6 +156,7 @@ public class GUI implements CPDListener {
             resultsTextArea.append(renderer.render(cpd));
         } catch (IOException ioe) {
             ioe.printStackTrace();
+            JOptionPane.showMessageDialog(null, "Halted due to " + ioe.getClass().getName() + "; " + ioe.getMessage());
         }
     }