URIConverter.Cipher cipher = options != null ? (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : null; if (cipher != null) { try { outputStream = cipher.encrypt(outputStream); } catch (Exception e) { throw new IOWrappedException(e); } }
URIConverter.Cipher cipher = options != null ? (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : null; if (cipher != null) { try { inputStream = cipher.decrypt(inputStream); } catch (Exception e) { throw new IOWrappedException(e); } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java
Method name: void save(OutputStream, Map) Method name: void load(InputStream, Map)
Number of AST nodes: 4 Number of AST nodes: 4
1
URIConverter.Cipher cipher = options != null ?
1
URIConverter.Cipher cipher = options != null ?
2
      (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) :
2
          (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) :
3
      null;
3
          null;
4
    if (cipher != null)
4
        if (cipher != null)
5
    {
5
        {
6
      try
6
      
7
    try
7
      {
8
          {
8
        outputStream = cipher.encrypt(outputStream);
9
            inputStream = cipher.decrypt(inputStream);
9
      }
10
      
11
    }
10
      catch (Exception e)
12
          catch (Exception e)
11
      {
13
      
14
    {
12
        throw new IOWrappedException(e);
15
            throw new IOWrappedException(e);
13
      }
16
      
17
    }
14
    }
18
        }
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.3
Clones locationClones are declared in the same class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    URIConverter.Cipher cipher = options != null ? (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : null;
    6
    URIConverter.Cipher cipher = options != null ? (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : null;
    17
    URIConverter.Cipher cipher = options != null ? (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : null;
    Differences
    Expression1Expression2Difference
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    VARIABLE_TYPE_MISMATCH
    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
    Type of variable options.get(Resource.OPTION_CIPHER) does not match with type of variable options.get(Resource.OPTION_CIPHER)
    • 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
    17
    URIConverter.Cipher cipher = options != null ? (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : null;
    7
    if (cipher != null)
    18
    if (cipher != null)
    8
    try
    19
    try
    9
    outputStream = cipher.encrypt(outputStream);
    9
    outputStream = cipher.encrypt(outputStream);
    Preondition Violations
    Unmatched statement outputStream=cipher.encrypt(outputStream); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement outputStream=cipher.encrypt(outputStream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                              
                                                                                            
    20
    inputStream = cipher.decrypt(inputStream);
    Preondition Violations
    Unmatched statement inputStream=cipher.decrypt(inputStream); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement inputStream=cipher.decrypt(inputStream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    20
    inputStream = cipher.decrypt(inputStream);
    Precondition Violations (7)
    Row Violation
    1Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    2Type of variable options.get(Resource.OPTION_CIPHER) does not match with type of variable options.get(Resource.OPTION_CIPHER)
    3Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    4Unmatched statement outputStream=cipher.encrypt(outputStream); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement outputStream=cipher.encrypt(outputStream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched statement inputStream=cipher.decrypt(inputStream); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement inputStream=cipher.decrypt(inputStream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted