String mimeType = activeDesktop.getMimeType(ext); if (mimeType.equals("application/octet-stream")) { // Try the built-in mime table return DefaultMimeTypeTable.lookup(ext); } else { return mimeType; }
String mimeType = activeDesktop.getMimeType(file); if (mimeType == null || mimeType.equals("application/octet-stream")) { // Try the built-in mime table return DefaultMimeTypeTable.lookup(file); } else { return mimeType; }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/desktop/ColumbaDesktop.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/desktop/ColumbaDesktop.java
Method name: String getMimeType(String) Method name: String getMimeType(File)
Number of AST nodes: 4 Number of AST nodes: 4
1
String mimeType = activeDesktop.getMimeType(ext);
1
String mimeType = activeDesktop.getMimeType(file);
2
		if (mimeType.equals("application/octet-stream")) {
2
		if (mimeType == null || mimeType.equals("application/octet-stream")) {
3
			// Try the built-in mime table
3
			// Try the built-in mime table
4
			return DefaultMimeTypeTable.lookup(ext);
4
			return DefaultMimeTypeTable.lookup(file);
5
		} else {
5
		} else {
6
			return mimeType;
6
			return mimeType;
7
		}
7
		}
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 comparisons10
  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 fragment3
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    String mimeType = activeDesktop.getMimeType(ext);
    1
    String mimeType = activeDesktop.getMimeType(ext);
    1
    String mimeType = activeDesktop.getMimeType(file);
    Differences
    Expression1Expression2Difference
    extfileVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.io.FileVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable ext does not match with type java.io.File of variable file
    • Make classes java.lang.String and java.io.File extend a common superclass
    1
    String mimeType = activeDesktop.getMimeType(file);
                                                                                                                                                
    2
    if (mimeType == null || mimeType.equals("application/octet-stream"))
    Preondition Violations
    Unmatched statement if(mimeType == null || mimeType.equals("application/octet-stream")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    if (mimeType == null || mimeType.equals("application/octet-stream"))
                                                                                            
    3
    return DefaultMimeTypeTable.lookup(file);
    Preondition Violations
    Unmatched statement return DefaultMimeTypeTable.lookup(file); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return DefaultMimeTypeTable.lookup(file);
    3
    return DefaultMimeTypeTable.lookup(file);
            
    else
                                          
    4
    return mimeType;
    Preondition Violations
    Unmatched statement return mimeType; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return mimeType;
    4
    return mimeType;
    2
    if (mimeType.equals("application/octet-stream"))
    2
    if (mimeType.equals("application/octet-stream"))
    Preondition Violations
    Unmatched statement if(mimeType.equals("application/octet-stream")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                        
    3
    return DefaultMimeTypeTable.lookup(ext);
    3
    return DefaultMimeTypeTable.lookup(ext);
    Preondition Violations
    Unmatched statement return DefaultMimeTypeTable.lookup(ext); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return DefaultMimeTypeTable.lookup(ext);
                                                                                          
    else
            
    4
    return mimeType;
    4
    return mimeType;
    Preondition Violations
    Unmatched statement return mimeType; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return mimeType;
                                          
    Precondition Violations (11)
    Row Violation
    1Type java.lang.String of variable ext does not match with type java.io.File of variable file
    2Unmatched statement if(mimeType == null || mimeType.equals("application/octet-stream")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement return DefaultMimeTypeTable.lookup(file); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return DefaultMimeTypeTable.lookup(file);
    5Unmatched statement return mimeType; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return mimeType;
    7Unmatched statement if(mimeType.equals("application/octet-stream")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement return DefaultMimeTypeTable.lookup(ext); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched return DefaultMimeTypeTable.lookup(ext);
    10Unmatched statement return mimeType; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched return mimeType;