/** * Add the file for which a path is given. * * @param path the path in String format */ public void setPath(String path) { StringTokenizer st = new StringTokenizer(path, ";"); st.countTokens(); while (st.hasMoreTokens()) { String token = st.nextToken(); try { this.addFile(new File(token)); } catch (MalformedURLException e) { LOG.warn("could not set path ", e); } } }
/** * @param paths the paths to the files to be added */ public void setPath(Object[] paths) { for (int i = 0; i < paths.length; i++) { try { this.addFile(new File(paths[i].toString())); } catch (Exception e) { LOG.warn("could not set path ", e); } } }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/reveng/ImportClassLoader.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/reveng/ImportClassLoader.java
Method name: void setPath(String) Method name: void setPath(Object[])
Number of AST nodes: 3 Number of AST nodes: 2
1
/**
1
/**
2
     * Add the file for which a path is given.
2
     * @param paths the paths to the files to be added
3
     *
3
     */
4
     * @param path the path in String format
4
    public void setPath(Object[] paths) {
5
     */
5
6
    public void setPath(String path) {
6
        for (int i = 0; i < paths.length; i++) {
7
7
8
        StringTokenizer st = new StringTokenizer(path, ";");
8
            try {
9
        st.countTokens();
9
		this.addFile(new File(paths[i].toString()));
10
        while (st.hasMoreTokens()) {
10
            } catch (Exception e) {
11
11
		LOG.warn("could not set path ", e);
12
            String token = st.nextToken();
12
	    }
13
13
        }
14
            try {
14
    }
15
		this.addFile(new File(token));
16
            } catch (MalformedURLException e) {
17
		LOG.warn("could not set path ", e);
18
	    }
19
        }
20
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.333
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    while (st.hasMoreTokens())
    3
    while (st.hasMoreTokens())
    1
    for (int i = 0; i < paths.length; i++)
    Differences
    Expression1Expression2Difference
    st.hasMoreTokens()i < paths.lengthTYPE_COMPATIBLE_REPLACEMENT
    java.lang.Stringjava.lang.Object[]VARIABLE_TYPE_MISMATCH
    java.lang.Stringjava.lang.Object[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable path does not match with type java.lang.Object[] of variable paths
    • Make classes java.lang.String and java.lang.Object[] extend a common superclass
    Type java.lang.String of variable path does not match with type java.lang.Object[] of variable paths
    • Make classes java.lang.String and java.lang.Object[] extend a common superclass
    1
    for (int i = 0; i < paths.length; i++)
    4
    String token = st.nextToken();
                                                                  
    5
    try
    5
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.net.MalformedURLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    java.net.MalformedURLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    java.net.MalformedURLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    2
    try
    6
    this.addFile(new File(token));
    6
    this.addFile(new File(token));
    3
    this.addFile(new File(paths[i].toString()));
    Differences
    Expression1Expression2Difference
    tokenpaths[i].toString()TYPE_COMPATIBLE_REPLACEMENT
    3
    this.addFile(new File(paths[i].toString()));
    Precondition Violations (2)
    Row Violation
    1Type java.lang.String of variable path does not match with type java.lang.Object[] of variable paths
    2Type java.lang.String of variable path does not match with type java.lang.Object[] of variable paths