try
{
Double.parseDouble(tfNewValue.getText());
}
catch (NumberFormatException ex)
{
JOptionPane.showMessageDialog(session.getApplication().getMainFrame(), i18n.GLOBAL_ERROR_FORMAT_NUMERIC);
tfNewValue.requestFocusInWindow();
return false;
}
try
{
Integer.parseInt(tfNewValue.getText());
}
catch (NumberFormatException ex)
{
JOptionPane.showMessageDialog(session.getApplication().getMainFrame(), i18n.GLOBAL_ERROR_FORMAT_INTEGER);
tfNewValue.requestFocusInWindow();
return false;
}
Clone fragments detected by clone detection tool
File path: /sql12/plugins/smarttools/src/net/sourceforge/squirrel_sql/plugins/smarttools/gui/SmarttoolChangeValuesFrame.java
|
|
File path: /sql12/plugins/smarttools/src/net/sourceforge/squirrel_sql/plugins/smarttools/gui/SmarttoolChangeValuesFrame.java
|
Method name: boolean isInputOK(int)
|
|
Method name: boolean isInputOK(int)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 2
|
|
1 | try↵ | | 1 | try↵
|
2 | {↵ | | 2 | {↵
|
3 | Double.parseDouble(tfNewValue.getText());↵ | | 3 | Integer.parseInt(tfNewValue.getText());↵
|
4 | }↵ | | 4 | }↵
|
5 | catch (NumberFormatException ex)↵ | | 5 | catch (NumberFormatException ex)↵
|
6 | {↵ | | 6 | {↵
|
7 | JOptionPane.showMessageDialog(session.getApplication().getMainFrame(), i18n.GLOBAL_ERROR_FORMAT_NUMERIC);↵ | | 7 | JOptionPane.showMessageDialog(session.getApplication().getMainFrame(), i18n.GLOBAL_ERROR_FORMAT_INTEGER);↵
|
8 | tfNewValue.requestFocusInWindow();↵ | | 8 | tfNewValue.requestFocusInWindow();↵
|
9 | return false;↵ | | 9 | return false;↵
|
10 | } | | 10 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are in the same method |
Number of node comparisons | 5 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
11 | try | | 8 | try |
| | | 9 | Integer.parseInt(tfNewValue.getText()); |
12 | Double.parseDouble(tfNewValue.getText()); | | | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement Integer.parseInt(tfNewValue.getText()); 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 |
2 | Unmatched statement Double.parseDouble(tfNewValue.getText()); 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 |