FileWrapper f = new FileWrapperImpl(System.getProperty("user.dir"), "a/b/c/../d/e/./f"); String path = f.getAbsolutePath(); path = path.replace(File.separatorChar, '/'); if (!path.startsWith("/")) { path = "/" + path; } URL url1 = new URL("file", "", path); URL url2 = f.toURL(); assertEquals("urls not equal", url1, url2);
FileWrapper f = new FileWrapperImpl(System.getProperty("user.dir"), "a/b/c/../d/e/./f"); String path = f.getAbsolutePath(); path = path.replace(File.separatorChar, '/'); if (!path.startsWith("/")) { path = "/" + path; } URI uri1 = new URI("file", null, path, null); URI uri2 = f.toURI(); assertEquals("uris not equal", uri1, uri2);
Clone fragments detected by clone detection tool
File path: /sql12/test/src/net/sourceforge/squirrel_sql/fw/util/FileTest.java File path: /sql12/test/src/net/sourceforge/squirrel_sql/fw/util/FileTest.java
Method name: void test_toURL2() Method name: void test_toURI2()
Number of AST nodes: 8 Number of AST nodes: 8
1
FileWrapper f = new FileWrapperImpl(System.getProperty("user.dir"), "a/b/c/../d/e/./f");
1
FileWrapper f = new FileWrapperImpl(System.getProperty("user.dir"), "a/b/c/../d/e/./f");
2
        String path = f.getAbsolutePath();
2
        String path = f.getAbsolutePath();
3
        path = path.replace(File.separatorChar, '/');
3
        path = path.replace(File.separatorChar, '/');
4
        if (!path.startsWith("/")) {
4
        if (!path.startsWith("/")) {
5
            path = "/" + path;
5
            path = "/" + path;
6
        }
6
        }
7
        URL url1 = new URL("file", "", path);
7
        URI uri1 = new URI("file", null, path, null);
8
        URL url2 = f.toURL();
8
        URI uri2 = f.toURI();
9
        assertEquals("urls not equal", url1, url2);
9
        assertEquals("uris not equal", uri1, uri2);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    FileWrapper f = new FileWrapperImpl(System.getProperty("user.dir"), "a/b/c/../d/e/./f");
    1
    FileWrapper f = new FileWrapperImpl(System.getProperty("user.dir"), "a/b/c/../d/e/./f");
    2
    String path = f.getAbsolutePath();
    2
    String path = f.getAbsolutePath();
    3
    path = path.replace(File.separatorChar, '/');
    3
    path = path.replace(File.separatorChar, '/');
    4
    if (!path.startsWith("/"))
    4
    if (!path.startsWith("/"))
    5
    path = "/" + path;
    5
    path = "/" + path;
                                                                                          
    6
    URI uri1 = new URI("file", null, path, null);
    Preondition Violations
    Unmatched statement URI uri1=new URI("file",null,path,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    URI uri1 = new URI("file", null, path, null);
    6
    URL url1 = new URL("file", "", path);
    6
    URL url1 = new URL("file", "", path);
    Preondition Violations
    Unmatched statement URL url1=new URL("file","",path); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
                                                
    7
    URI uri2 = f.toURI();
    Preondition Violations
    Unmatched statement URI uri2=f.toURI(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    URI uri2 = f.toURI();
    7
    URL url2 = f.toURL();
    7
    URL url2 = f.toURL();
    Preondition Violations
    Unmatched statement URL url2=f.toURL(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                
    8
    assertEquals("urls not equal", url1, url2);
    8
    assertEquals("urls not equal", url1, url2);
    8
    assertEquals("uris not equal", uri1, uri2);
    Differences
    Expression1Expression2Difference
    "urls not equal""uris not equal"LITERAL_VALUE_MISMATCH
    url1uri1VARIABLE_NAME_MISMATCH
    java.net.URLjava.net.URIVARIABLE_TYPE_MISMATCH
    url2uri2VARIABLE_NAME_MISMATCH
    java.net.URLjava.net.URIVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.URL of variable url1 does not match with type java.net.URI of variable uri1
    • Make classes java.net.URL and java.net.URI extend a common superclass
    Type java.net.URL of variable url2 does not match with type java.net.URI of variable uri2
    • Make classes java.net.URL and java.net.URI extend a common superclass
    8
    assertEquals("uris not equal", uri1, uri2);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement URI uri1=new URI("file",null,path,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement URL url1=new URL("file","",path); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement URI uri2=f.toURI(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement URL url2=f.toURL(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Type java.net.URL of variable url1 does not match with type java.net.URI of variable uri1
    6Type java.net.URL of variable url2 does not match with type java.net.URI of variable uri2