int len = din.readInt(); if(len == 0) return null; char[] str = new char[len]; for(int i = 0; i < len; i++) str[i] = din.readChar(); return new String(str);
int len = din.readInt(); if(len == 0) return null; String[] str = new String[len]; for(int i = 0; i < len; i++) { str[i] = readString(din); } return str;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/PluginJAR.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/PluginJAR.java
Method name: String readString(DataInputStream) Method name: String[] readStringArray(DataInputStream)
Number of AST nodes: 7 Number of AST nodes: 7
1
int len = din.readInt();
1
int len = din.readInt();
2
			if(len == 0)
2
			if(len == 0)
3
				return null;
3
				return null;
4
			char[] str = new char[len];
4
			String[] str = new String[len];
5
			for(int i = 0; i < len; i++)
5
			for(int i = 0; i < len; i++)
6
			
6
			{
7
	str[i] = din.readChar();
7
				str[i] = readString(din);
8
			
8
			}
9
return new String(str);
9
			return str;
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.2
Clones locationClones are declared in the same class
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int len = din.readInt();
    1
    int len = din.readInt();
    2
    if (len == 0)
    2
    if (len == 0)
    3
    return null;
    3
    return null;
                                                                    
    4
    String[] str = new String[len];
    4
    char[] str = new char[len];
                                                            
    5
    for (int i = 0; i < len; i++)
    5
    for (int i = 0; i < len; i++)
                                                        
    6
    str[i] = readString(din);
    Preondition Violations
    Unmatched statement str[i]=readString(din); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    str[i] = readString(din);
    6
    str[i] = din.readChar();
    6
    str[i] = din.readChar();
    Preondition Violations
    Unmatched statement str[i]=din.readChar(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                      
                                
    7
    return str;
    Preondition Violations
    Unmatched return str;
    7
    return str;
    7
    return new String(str);
    7
    return new String(str);
    Preondition Violations
    Unmatched return new String(str);
                                                        
    Precondition Violations (5)
    Row Violation
    1Unmatched statement str[i]=readString(din); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement str[i]=din.readChar(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return str;
    4Unmatched return new String(str);
    5Clone fragment #1 returns variables len, i , while Clone fragment #2 returns variables len, i