File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/Utilities.java | File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/Utilities.java | |||
Method name: String getFileNameSuffix(String)
|
Method name: String removeFileNameSuffix(String)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | if (fileName == null)↵ | 1 | if (fileName == null)↵ | |
2 | {↵ | 2 | {↵ | |
3 | throw new IllegalArgumentException("file name == null");↵ | 3 | throw new IllegalArgumentException("file name == null");↵ | |
4 | }↵ | 4 | }↵ | |
5 | int pos = fileName.lastIndexOf('.');↵ | 5 | int pos = fileName.lastIndexOf('.');↵ | |
6 | if (pos > 0 && pos < fileName.length() - 1)↵ | 6 | if (pos > 0 && pos < fileName.length() - 1)↵ | |
7 | {↵ | 7 | {↵ | |
8 | return fileName.substring(pos + 1);↵ | 8 | return fileName.substring(0, pos);↵ | |
9 | }↵ | 9 | }↵ | |
10 | return ""; | 10 | return fileName; | |
See real code fragment | See real code fragment |
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 14 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (fileName == null) | 1 | if (fileName == null) | |||||||||||||
2 | throw new IllegalArgumentException("file name == null"); | 2 | throw new IllegalArgumentException("file name == null"); | |||||||||||||
3 | int pos = fileName.lastIndexOf('.'); | 3 | int pos = fileName.lastIndexOf('.'); | |||||||||||||
4 | if (pos > 0 && pos < fileName.length() - 1) | 4 | if (pos > 0 && pos < fileName.length() - 1) | |||||||||||||
5 | return fileName.substring(pos + 1); |
| 5 | return fileName.substring(0, pos); | ||||||||||||
6 | return ""; |
| 6 | return fileName; |
Row | Violation |
---|---|
1 | Expression fileName.substring(pos + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression fileName.substring(0,pos) cannot be parameterized, because it has dependencies to/from statements that will be extracted |