if (value.equals("<null>") || value.equals("")) return null; // Do the conversion into the object in a safe manner try { Object obj = new Long(value); return obj; } catch (Exception e) { messageBuffer.append(e.toString()+"\n"); //?? do we need the message also, or is it automatically part of the toString()? //messageBuffer.append(e.getMessage()); return null; }
if (value.equals("<null>") || value.equals("")) return null; // Do the conversion into the object in a safe manner try { Object obj = new Short(value); return obj; } catch (Exception e) { messageBuffer.append(e.toString()+"\n"); //?? do we need the message also, or is it automatically part of the toString()? //messageBuffer.append(e.getMessage()); return null; }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeLong.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeShort.java
Method name: Object validateAndConvert(String, Object, StringBuffer) Method name: Object validateAndConvert(String, Object, StringBuffer)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (value.equals("<null>") || value.equals(""))
1
if (value.equals("<null>") || value.equals(""))
2
			return null;
2
			return null;
3
		// Do the conversion into the object in a safe manner
3
		// Do the conversion into the object in a safe manner
4
		try {
4
		try {
5
			Object obj = new Long(value);
5
			Object obj = new Short(value);
6
			return obj;
6
			return obj;
7
		}
7
		}
8
		catch (Exception e) {
8
		catch (Exception e) {
9
			messageBuffer.append(e.toString()+"\n");
9
			messageBuffer.append(e.toString()+"\n");
10
			//?? do we need the message also, or is it automatically part of the toString()?
10
			//?? do we need the message also, or is it automatically part of the toString()?
11
			//messageBuffer.append(e.getMessage());
11
			//messageBuffer.append(e.getMessage());
12
			return null;
12
			return null;
13
		}
13
		}
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 in different classes having the same super class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (value.equals("<null>") || value.equals(""))
    1
    if (value.equals("<null>") || value.equals(""))
    2
    return null;
    2
    return null;
    3
    try
    3
    try
    4
    Object obj = new Long(value);
    4
    Object obj = new Long(value);
    4
    Object obj = new Short(value);
    Differences
    Expression1Expression2Difference
    java.lang.Longjava.lang.ShortSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new Long(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression new Short(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4
    Object obj = new Short(value);
    5
    return obj;
    5
    return obj;
    Precondition Violations (3)
    Row Violation
    1Expression new Long(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression new Short(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Not all possible execution flows end in a return statement