try { setValue(new Long(parameters[i].getValue() ).longValue()); } catch (NumberFormatException nfe) { setError("Invalid size setting " + parameters[i].getValue()); }
try { setGranularity(new Integer(parameters[i].getValue() ).intValue()); } catch (NumberFormatException nfe) { setError("Invalid granularity setting " + parameters[i].getValue()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/SizeSelector.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/DateSelector.java
Method name: void setParameters(Parameter[]) Method name: void setParameters(Parameter[])
Number of AST nodes: 2 Number of AST nodes: 2
1
try {
1
try {
2
                        setValue(new Long(parameters[i].getValue()
2
                        setGranularity(new Integer(parameters[i].getValue()
3
                        ).longValue());
3
                        ).intValue());
4
                    } catch (NumberFormatException nfe) {
4
                    } catch (NumberFormatException nfe) {
5
                        setError("Invalid size setting "
5
                        setError("Invalid granularity setting "
6
                                + parameters[i].getValue());
6
                            + parameters[i].getValue());
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    try
    6
    try
    13
    try
    Differences
    Expression1Expression2Difference
    "Invalid size setting ""Invalid granularity setting "LITERAL_VALUE_MISMATCH
    13
    try
    7
    setValue(new Long(parameters[i].getValue()).longValue());
    7
    setValue(new Long(parameters[i].getValue()).longValue());
    14
    setGranularity(new Integer(parameters[i].getValue()).intValue());
    Differences
    Expression1Expression2Difference
    longValueintValueMETHOD_INVOCATION_NAME_MISMATCH
    longintVARIABLE_TYPE_MISMATCH
    java.lang.Longjava.lang.IntegerSUBCLASS_TYPE_MISMATCH
    setValuesetGranularityMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression new Long(parameters[i].getValue()).longValue() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression new Integer(parameters[i].getValue()).intValue() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Type long of variable new Long(parameters[i].getValue()).longValue() does not match with type int of variable new Integer(parameters[i].getValue()).intValue()
    Expression new Long(parameters[i].getValue()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression new Integer(parameters[i].getValue()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression setValue(new Long(parameters[i].getValue()).longValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setGranularity(new Integer(parameters[i].getValue()).intValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setValue(new Long(parameters[i].getValue()).longValue()) is a void method call, and thus it cannot be parameterized
    Expression setGranularity(new Integer(parameters[i].getValue()).intValue()) is a void method call, and thus it cannot be parameterized
    14
    setGranularity(new Integer(parameters[i].getValue()).intValue());
    Precondition Violations (9)
    Row Violation
    1Expression new Long(parameters[i].getValue()).longValue() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression new Integer(parameters[i].getValue()).intValue() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Type long of variable new Long(parameters[i].getValue()).longValue() does not match with type int of variable new Integer(parameters[i].getValue()).intValue()
    4Expression new Long(parameters[i].getValue()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    5Expression new Integer(parameters[i].getValue()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    6Expression setValue(new Long(parameters[i].getValue()).longValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression setGranularity(new Integer(parameters[i].getValue()).intValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression setValue(new Long(parameters[i].getValue()).longValue()) is a void method call, and thus it cannot be parameterized
    9Expression setGranularity(new Integer(parameters[i].getValue()).intValue()) is a void method call, and thus it cannot be parameterized