boolean valid = true; try { if (Double.parseDouble(candidate) >= this.maximumValue) { valid = false; } } catch (NumberFormatException e) { valid = false; } return valid;
boolean valid = true; try { if (Double.parseDouble(candidate) <= this.minimumValue) { valid = false; } } catch (NumberFormatException e) { valid = false; } return valid;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/editor/SWTNumberAxisEditor.java File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/editor/SWTNumberAxisEditor.java
Method name: boolean validateMinimum(String) Method name: boolean validateMaximum(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
boolean valid = true;
1
boolean valid = true;
2
        try {
2
        try {
3
            if (Double.parseDouble(candidate) &gt;= this.maximumValue) {
3
            if (Double.parseDouble(candidate) &lt;= this.minimumValue) {
4
                valid = false;
4
                valid = false;
5
            }
5
            }
6
        }
6
        }
7
        catch (NumberFormatException e) {
7
        catch (NumberFormatException e) {
8
            valid = false;
8
            valid = false;
9
        }
9
        }
10
        return valid;
10
        return valid;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons6
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    boolean valid = true;
    1
    boolean valid = true;
    2
    try
    2
    try
                                                                                                                      
    3
    if (Double.parseDouble(candidate) <= this.minimumValue)
    Preondition Violations
    Unmatched statement if(Double.parseDouble(candidate) <= this.minimumValue) 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
    3
    if (Double.parseDouble(candidate) <= this.minimumValue)
                                  
    4
    valid = false;
    Preondition Violations
    Unmatched statement valid=false; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    valid = false;
    3
    if (Double.parseDouble(candidate) >= this.maximumValue)
    3
    if (Double.parseDouble(candidate) >= this.maximumValue)
    Preondition Violations
    Unmatched statement if(Double.parseDouble(candidate) >= this.maximumValue) 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
    valid = false;
    4
    valid = false;
    Preondition Violations
    Unmatched statement valid=false; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                  
    5
    return valid;
    5
    return valid;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement if(Double.parseDouble(candidate) <= this.minimumValue) 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
    2Unmatched statement valid=false; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement if(Double.parseDouble(candidate) >= this.maximumValue) 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
    4Unmatched statement valid=false; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted