String result = toFormat; try { result = formatter.reformat(toFormat); } catch (IllegalStateException e) { s_log.error("format: Formatting SQL failed: "+e.getMessage(), e); } return result;
int result = defaultNum; try { result = Integer.parseInt(numberStr); } catch (NumberFormatException e) { s_log.error("getNumber: Unexpected exception - " + e.getMessage(), e); } return result;
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/tabs/FormattedSourceTab.java File path: /sql12/plugins/informix/src/net/sourceforge/squirrel_sql/plugins/informix/exception/InformixExceptionFormatter.java
Method name: String format(String) Method name: int getNumber(String, int)
Number of AST nodes: 4 Number of AST nodes: 4
1
String result = toFormat;
1
int result = defaultNum;
2
        try {
2
        try {
3
            result = formatter.reformat(toFormat);
3
            result = Integer.parseInt(numberStr);
4
        } catch (IllegalStateException e) {
4
        } catch (NumberFormatException e) {
5
            s_log.error("format: Formatting SQL failed: "+
5
            s_log.error("getNumber: Unexpected exception - "
6
e.getMessage(), e);
6
                + e.getMessage(), e);
7
        }
7
        }
8
        return result;
8
        return result;
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
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                      
    1
    int result = defaultNum;
    1
    String result = toFormat;
                                                        
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.lang.IllegalStateExceptionjava.lang.NumberFormatExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.IllegalStateExceptionjava.lang.NumberFormatExceptionSUBCLASS_TYPE_MISMATCH
    "format: Formatting SQL failed: ""getNumber: Unexpected exception - "LITERAL_VALUE_MISMATCH
    java.lang.IllegalStateExceptionjava.lang.NumberFormatExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.IllegalStateExceptionjava.lang.NumberFormatExceptionSUBCLASS_TYPE_MISMATCH
    2
    try
                                                                                
    3
    result = Integer.parseInt(numberStr);
    Preondition Violations
    Unmatched statement result=Integer.parseInt(numberStr); 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
    result = Integer.parseInt(numberStr);
    3
    result = formatter.reformat(toFormat);
    3
    result = formatter.reformat(toFormat);
    Preondition Violations
    Unmatched statement result=formatter.reformat(toFormat); 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
    return result;
    Preondition Violations
    Unmatched return result;
    4
    return result;
    4
    return result;
    4
    return result;
    Preondition Violations
    Unmatched return result;
                                      
    Precondition Violations (5)
    Row Violation
    1Unmatched statement result=Integer.parseInt(numberStr); 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 result=formatter.reformat(toFormat); 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
    3Unmatched return result;
    4Unmatched return result;
    5The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.FormattedSourceTab and net.sourceforge.squirrel_sql.plugins.informix.exception.InformixExceptionFormatter do not have a common superclass