XMLSave xmlSave = createXMLSave(); if (options == null) { options = Collections.EMPTY_MAP; } ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER); if (handler != null) { handler.preSave(this, outputStream, options); } xmlSave.save(this, outputStream, options); if (handler != null) { handler.postSave(this, outputStream, options); }
XMLLoad xmlLoad = createXMLLoad(); if (options == null) { options = Collections.EMPTY_MAP; } ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER); if (handler != null) { handler.preLoad(this, inputStream, options); } xmlLoad.load(this, inputStream, options); if (handler != null) { handler.postLoad(this, inputStream, options); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLResourceImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLResourceImpl.java
Method name: void doSave(OutputStream, Map) Method name: void doLoad(InputStream, Map)
Number of AST nodes: 9 Number of AST nodes: 9
1
XMLSave xmlSave = createXMLSave();
1
XMLLoad xmlLoad = createXMLLoad();
2
    if (options == null)
2
    if (options == null)
3
    {
3
    {
4
      options = Collections.EMPTY_MAP;
4
      options = Collections.EMPTY_MAP;
5
    }
5
    }
6
    ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER);
6
    ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER);
7
    if (handler != null)
7
    if (handler != null)
8
    {
8
    {
9
      handler.preSave(this, outputStream, options);
9
      handler.preLoad(this, inputStream, options);
10
    }
10
    }
11
    xmlSave.save(this, outputStream, options);
11
    xmlLoad.load(this, inputStream, options);
12
    if (handler != null)
12
    if (handler != null)
13
    {
13
    {
14
      handler.postSave(this, outputStream, options);
14
      handler.postLoad(this, inputStream, options);
15
    }
15
    }
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.4
Clones locationClones are declared in the same class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)3.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                          
    1
    XMLLoad xmlLoad = createXMLLoad();
    1
    XMLSave xmlSave = createXMLSave();
                                                                          
    2
    if (options == null)
    2
    if (options == null)
    2
    if (options == null)
    Differences
    Expression1Expression2Difference
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    • Make classes java.util.Map<,> and java.util.Map<,> extend a common superclass
    2
    if (options == null)
    3
    options = Collections.EMPTY_MAP;
    3
    options = Collections.EMPTY_MAP;
    4
    ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER);
    4
    ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER);
    4
    ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER);
    Differences
    Expression1Expression2Difference
    VARIABLE_TYPE_MISMATCH
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression options.get(OPTION_RESOURCE_HANDLER) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression options.get(OPTION_RESOURCE_HANDLER) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type of variable options.get(OPTION_RESOURCE_HANDLER) does not match with type of variable options.get(OPTION_RESOURCE_HANDLER)
    • Make classes and extend a common superclass
    Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    • Make classes java.util.Map<,> and java.util.Map<,> extend a common superclass
    4
    ResourceHandler handler = (ResourceHandler)options.get(OPTION_RESOURCE_HANDLER);
    5
    if (handler != null)
    5
    if (handler != null)
                                                                                              
    6
    handler.preLoad(this, inputStream, options);
    Preondition Violations
    Unmatched statement handler.preLoad(this,inputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    handler.preLoad(this, inputStream, options);
    6
    handler.preSave(this, outputStream, options);
    6
    handler.preSave(this, outputStream, options);
    Preondition Violations
    Unmatched statement handler.preSave(this,outputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                
                                                                                        
    7
    xmlLoad.load(this, inputStream, options);
    7
    xmlSave.save(this, outputStream, options);
                                                                                          
    8
    if (handler != null)
    8
    if (handler != null)
                                                                                                
    9
    handler.postLoad(this, inputStream, options);
    Preondition Violations
    Unmatched statement handler.postLoad(this,inputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    handler.postLoad(this, inputStream, options);
    9
    handler.postSave(this, outputStream, options);
    9
    handler.postSave(this, outputStream, options);
    Preondition Violations
    Unmatched statement handler.postSave(this,outputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                  
    Precondition Violations (10)
    Row Violation
    1Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    2Expression options.get(OPTION_RESOURCE_HANDLER) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression options.get(OPTION_RESOURCE_HANDLER) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type of variable options.get(OPTION_RESOURCE_HANDLER) does not match with type of variable options.get(OPTION_RESOURCE_HANDLER)
    5Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    6Unmatched statement handler.preLoad(this,inputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement handler.preSave(this,outputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement handler.postLoad(this,inputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement handler.postSave(this,outputStream,options); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Clone fragment #1 returns variables options, handler , while Clone fragment #2 returns variables options, handler