int[] bounds = entryPanel.getBoundsOfSQLToBeExecuted(); if(bounds[0] == bounds[1]) { return; } String textToQuote = entryPanel.getSQLToBeExecuted(); if (null == textToQuote) { return; } String quotedText = Utilities.quoteText(textToQuote, sbAppend); entryPanel.setSelectionStart(bounds[0]); entryPanel.setSelectionEnd(bounds[1]); entryPanel.replaceSelection(quotedText);
int[] bounds = entryPanel.getBoundsOfSQLToBeExecuted(); if(bounds[0] == bounds[1]) { return; } String textToUnquote = entryPanel.getSQLToBeExecuted(); if (null == textToUnquote) { return; } String unquotedText = Utilities.unquoteText(textToUnquote); entryPanel.setSelectionStart(bounds[0]); entryPanel.setSelectionEnd(bounds[1]); entryPanel.replaceSelection(unquotedText);
Clone fragments detected by clone detection tool
File path: /sql12/plugins/editextras/src/net/sourceforge/squirrel_sql/plugins/editextras/InQuotesCommand.java File path: /sql12/plugins/editextras/src/net/sourceforge/squirrel_sql/plugins/editextras/RemoveQuotesCommand.java
Method name: void quoteSQL(ISQLEntryPanel, boolean) Method name: void unquoteSQL(ISQLEntryPanel)
Number of AST nodes: 10 Number of AST nodes: 10
1
int[] bounds = entryPanel.getBoundsOfSQLToBeExecuted();
1
int[] bounds = entryPanel.getBoundsOfSQLToBeExecuted();
2
      if(bounds[0] == bounds[1])
2
      if(bounds[0] == bounds[1])
3
      {
3
      {
4
         return;
4
         return;
5
      }
5
      }
6
      String textToQuote = entryPanel.getSQLToBeExecuted();
6
      String textToUnquote = entryPanel.getSQLToBeExecuted();
7
      if (null == textToQuote)
7
      if (null == textToUnquote)
8
      {
8
      {
9
         return;
9
         return;
10
      }
10
      }
11
      String quotedText = Utilities.quoteText(textToQuote, sbAppend);
11
      String unquotedText = Utilities.unquoteText(textToUnquote);
12
      entryPanel.setSelectionStart(bounds[0]);
12
      entryPanel.setSelectionStart(bounds[0]);
13
      entryPanel.setSelectionEnd(bounds[1]);
13
      entryPanel.setSelectionEnd(bounds[1]);
14
      entryPanel.replaceSelection(quotedText);
14
      entryPanel.replaceSelection(unquotedText);
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.3
Clones locationClones are in different classes
Number of node comparisons46
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int[] bounds = entryPanel.getBoundsOfSQLToBeExecuted();
    1
    int[] bounds = entryPanel.getBoundsOfSQLToBeExecuted();
    2
    if (bounds[0] == bounds[1])
    2
    if (bounds[0] == bounds[1])
    3
    return;
    3
    return;
    4
    String textToQuote = entryPanel.getSQLToBeExecuted();
    4
    String textToQuote = entryPanel.getSQLToBeExecuted();
    4
    String textToUnquote = entryPanel.getSQLToBeExecuted();
    Differences
    Expression1Expression2Difference
    textToQuotetextToUnquoteVARIABLE_NAME_MISMATCH
    4
    String textToUnquote = entryPanel.getSQLToBeExecuted();
    5
    if (null == textToQuote)
    5
    if (null == textToQuote)
    5
    if (null == textToUnquote)
    Differences
    Expression1Expression2Difference
    textToQuotetextToUnquoteVARIABLE_NAME_MISMATCH
    5
    if (null == textToUnquote)
    6
    return;
    6
    return;
    7
    String quotedText = Utilities.quoteText(textToQuote, sbAppend);
    7
    String quotedText = Utilities.quoteText(textToQuote, sbAppend);
    7
    String unquotedText = Utilities.unquoteText(textToUnquote);
    Differences
    Expression1Expression2Difference
    quotedTextunquotedTextVARIABLE_NAME_MISMATCH
    quoteTextunquoteTextMETHOD_INVOCATION_NAME_MISMATCH
    Utilities.quoteText(textToQuote,sbAppend)Utilities.unquoteText(textToUnquote)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression Utilities.quoteText(textToQuote,sbAppend) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression Utilities.unquoteText(textToUnquote) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression Utilities.quoteText(textToQuote,sbAppend) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression Utilities.unquoteText(textToUnquote) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    String unquotedText = Utilities.unquoteText(textToUnquote);
    8
    entryPanel.setSelectionStart(bounds[0]);
    8
    entryPanel.setSelectionStart(bounds[0]);
    9
    entryPanel.setSelectionEnd(bounds[1]);
    9
    entryPanel.setSelectionEnd(bounds[1]);
    10
    entryPanel.replaceSelection(quotedText);
    10
    entryPanel.replaceSelection(quotedText);
    10
    entryPanel.replaceSelection(unquotedText);
    Differences
    Expression1Expression2Difference
    quotedTextunquotedTextVARIABLE_NAME_MISMATCH
    10
    entryPanel.replaceSelection(unquotedText);
    Precondition Violations (4)
    Row Violation
    1Expression Utilities.quoteText(textToQuote,sbAppend) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression Utilities.unquoteText(textToUnquote) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression Utilities.quoteText(textToQuote,sbAppend) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression Utilities.unquoteText(textToUnquote) cannot be parameterized, because it has dependencies to/from statements that will be extracted