File xsl = getFile("/taskdefs/optional/xsltliaison-in.xsl"); liaison.setStylesheet(xsl); liaison.addParam("param", "value"); File in = getFile("/taskdefs/optional/xsltliaison-in.xml"); File out = new File("xsltliaison.tmp"); out.deleteOnExit(); // just to be sure try { liaison.transform(in, out); } finally { out.delete(); }
File cachefile = new File(basedir, "cachefile.properties"); PropertiesfileCache cache = new PropertiesfileCache(); cache.setCachefile(cachefile); cache.put("key", "value"); cache.save(); assertTrue("Cachefile not created.", cachefile.exists()); cache.delete(); assertFalse("Cachefile not deleted.", cachefile.exists());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
Method name: void testTransform() Method name: void testCreatePropertiesCacheDirect()
Number of AST nodes: 8 Number of AST nodes: 8
1
File xsl = getFile("/taskdefs/optional/xsltliaison-in.xsl");
1
File cachefile = new File(
2
        liaison.setStylesheet(xsl
2
basedir, "cachefile.properties");
3
        PropertiesfileCache cache = new PropertiesfileCache();
3
);
4
        cache.setCachefile(cachefile);
4
        liaison.addParam("param", "value");
5
        
5
        File in = getFile("/taskdefs/optional/xsltliaison-in.xml"
6
cache.put("key", "value");
6
);
7
        cache.save();
7
        File out = new File("xsltliaison.tmp");
8
        assertTrue("Cachefile not created.", cachefile.exists());
8
        out.deleteOnExit(); // just to be sure
9
        cache.delete
9
        try {
10
            liaison.transform(in, out);
11
        } finally {
12
            out.delete();
13
        }
10
();
11
        assertFalse("Cachefile not deleted.", cachefile.exists());
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons40
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    File xsl = getFile("/taskdefs/optional/xsltliaison-in.xsl");
                                                                                                                              
    2
    liaison.setStylesheet(xsl);
    2
    liaison.setStylesheet(xsl);
    8
    assertFalse("Cachefile not deleted.", cachefile.exists());
    Differences
    Expression1Expression2Difference
    setStylesheetassertFalseMETHOD_INVOCATION_NAME_MISMATCH
    liaison.setStylesheet(xsl)assertFalse("Cachefile not deleted.",cachefile.exists())ARGUMENT_NUMBER_MISMATCH
    liaisonMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression liaison.setStylesheet(xsl) is a void method call, and thus it cannot be parameterized
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression liaison.setStylesheet(xsl) is a void method call, and thus it cannot be parameterized
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    8
    assertFalse("Cachefile not deleted.", cachefile.exists());
    3
    liaison.addParam("param", "value");
                                                                              
    4
    File in = getFile("/taskdefs/optional/xsltliaison-in.xml");
                                                                                                                            
    5
    File out = new File("xsltliaison.tmp");
    5
    File out = new File("xsltliaison.tmp");
    1
    File cachefile = new File(basedir, "cachefile.properties");
    Differences
    Expression1Expression2Difference
    outcachefileVARIABLE_NAME_MISMATCH
    new File("xsltliaison.tmp")new File(basedir,"cachefile.properties")ARGUMENT_NUMBER_MISMATCH
    1
    File cachefile = new File(basedir, "cachefile.properties");
                                                                                                                  
    2
    PropertiesfileCache cache = new PropertiesfileCache();
                                                                      
    3
    cache.setCachefile(cachefile);
                                                            
    4
    cache.put("key", "value");
                                    
    5
    cache.save();
    6
    out.deleteOnExit();
    6
    out.deleteOnExit();
    6
    assertTrue("Cachefile not created.", cachefile.exists());
    Differences
    Expression1Expression2Difference
    deleteOnExitassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    out.deleteOnExit()assertTrue("Cachefile not created.",cachefile.exists())ARGUMENT_NUMBER_MISMATCH
    outMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression out.deleteOnExit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression out.deleteOnExit() is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    Expression out.deleteOnExit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression out.deleteOnExit() is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    6
    assertTrue("Cachefile not created.", cachefile.exists());
                                        
    7
    cache.delete();
    Precondition Violations (14)
    Row Violation
    1Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression liaison.setStylesheet(xsl) is a void method call, and thus it cannot be parameterized
    3Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    4Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression liaison.setStylesheet(xsl) is a void method call, and thus it cannot be parameterized
    6Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    7Expression out.deleteOnExit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression out.deleteOnExit() is a void method call, and thus it cannot be parameterized
    10Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    11Expression out.deleteOnExit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression out.deleteOnExit() is a void method call, and thus it cannot be parameterized
    14Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized