if (value.equals("<null>") || value.equals("")) return null; // Do the conversion into the object in a safe manner try { Object obj = Boolean.valueOf(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 Byte(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/DataTypeBoolean.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeByte.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
		{
5
 {
6
			Object obj = Boolean.valueOf(value);
6
			Object obj = new Byte(value);
7
			return obj;
7
			return obj;
8
		}
8
		}
9
		catch (Exception e)
9
		catch (Exception e)
10
		{
10
 {
11
			messageBuffer.append(e.toString() + "\n");
11
			messageBuffer.append(e.toString()+"\n");
12
			// ?? do we need the message also, or is it automatically part of the toString()?
12
			//?? do we need the message also, or is it automatically part of the toString()?
13
			// messageBuffer.append(e.getMessage());
13
			//messageBuffer.append(e.getMessage());
14
			return null;
14
			return null;
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 in different classes having the same super class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.2
    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 Byte(value);
    Preondition Violations
    Unmatched statement Object obj=new Byte(value); 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
    4
    Object obj = new Byte(value);
    4
    Object obj = Boolean.valueOf(value);
                                                                              
    5
    return obj;
    5
    return obj;
    Precondition Violations (2)
    Row Violation
    1Unmatched statement Object obj=new Byte(value); 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
    2Not all possible execution flows end in a return statement