125-1-2

File dir = getProject().resolveFile(localPath); if (!dir.exists()) { boolean done = dir.mkdirs(); if (!done) { String msg = "Directory " + localPath + " creation was not " + "successful for an unknown reason"; throw new BuildException(msg, getLocation()); } getProject().log("Created dir: " + dir.getAbsolutePath()); } return dir.getAbsolutePath();
if (localPath != null) { //make sure m_LocalDir exists, create it if it doesn't File dir = getProject().resolveFile(localPath); if (!dir.exists()) { boolean done = dir.mkdirs(); if (!done) { String msg = "Directory " + localPath + " creation was not " + "successful for an unknown reason"; throw new BuildException(msg, getLocation()); } getProject().log("Created dir: " + dir.getAbsolutePath()); } lclPath = FLAG_OVERRIDE_WORKING_DIR + localPath; }

Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/sos/SOS.java |  | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
Method name: `String getLocalPath()` |  | Method name: `String getLocalpath()`
Number of AST nodes: 8 |  | Number of AST nodes: 9

1

    if (localPath != null) {↵

2

                //make sure m_LocalDir exists, create it if it doesn't↵

1

    File dir = getProject().resolveFile(localPath);↵

3

                File dir = getProject().resolveFile(localPath);↵

2

                if (!dir.exists()) {↵

4

                if (!dir.exists()) {↵

3

                    boolean done = dir.mkdirs();↵

5

                    boolean done = dir.mkdirs();↵

4

                    if (!done) {↵

6

                    if (!done) {↵

5

                        String msg = "Directory " + localPath + " creation was not "↵

7

                        String msg = "Directory " + localPath + " creation was not "↵

6

                            + "successful for an unknown reason";↵

8

                                + "successful for an unknown reason";↵

7

                        throw new BuildException(msg, getLocation());↵

9

                        throw new BuildException(msg, getLocation());↵

8

                    }↵

10

                    }↵

9

                    getProject().log("Created dir: " + dir.getAbsolutePath());↵

11

                    getProject().log("Created dir: " + dir.getAbsolutePath());↵

10

                }↵

12

                }↵

11

                return dir.getAbsolutePath();

13

                lclPath = FLAG_OVERRIDE_WORKING_DIR + localPath;↵

14

            }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 22

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 1.3
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   3

       File dir = getProject().resolveFile(localPath);

   3

       File dir = getProject().resolveFile(localPath);

   4

       if (!dir.exists())

   4

       if (!dir.exists())

   5

       boolean done = dir.mkdirs();

   5

       boolean done = dir.mkdirs();

   6

       if (!done)

   6

       if (!done)

   7

       String msg = "Directory " + localPath + " creation was not " + "successful for an unknown reason";

   7

       String msg = "Directory " + localPath + " creation was not " + "successful for an unknown reason";

   8

       throw new BuildException(msg, getLocation());

   8

       throw new BuildException(msg, getLocation());

   9

       getProject().log("Created dir: " + dir.getAbsolutePath());

   9

       getProject().log("Created dir: " + dir.getAbsolutePath());

   10

       lclPath = FLAG_OVERRIDE_WORKING_DIR + localPath;

   10

       return dir.getAbsolutePath();

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Clone fragment #1 returns variables dir , while Clone fragment #2 returns variables