if (fileName == null) { throw new IllegalArgumentException("file name == null"); } int pos = fileName.lastIndexOf('.'); if (pos > 0 && pos < fileName.length() - 1) { return fileName.substring(pos + 1); } return "";
if (fileName == null) { throw new IllegalArgumentException("file name == null"); } int pos = fileName.lastIndexOf('.'); if (pos > 0 && pos < fileName.length() - 1) { return fileName.substring(0, pos); } return fileName;
Clone fragments detected by clone detection tool
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;
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.4
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 2
    Mapped Statements
    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(pos + 1);
    5
    return fileName.substring(0, pos);
    Differences
    Expression1Expression2Difference
    fileName.substring(pos + 1)fileName.substring(0,pos)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression fileName.substring(pos + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression fileName.substring(0,pos) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    return fileName.substring(0, pos);
    6
    return "";
    6
    return "";
    6
    return fileName;
    Differences
    Expression1Expression2Difference
    ""fileNameTYPE_COMPATIBLE_REPLACEMENT
    6
    return fileName;
    Precondition Violations (2)
    Row Violation
    1Expression fileName.substring(pos + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression fileName.substring(0,pos) cannot be parameterized, because it has dependencies to/from statements that will be extracted