/** * Get a String containing a comma-separated list of the bibtex keys * of the selected entries. * * @return A comma-separated list of the keys of the selected entries. */ public String getKeysForSelection() { StringBuffer result = new StringBuffer(); String citeKey = "";//, message = ""; boolean first = true; for (BibtexEntry bes : mainTable.getSelected()){ citeKey = bes.getField(BibtexFields.KEY_FIELD); // if the key is empty we give a warning and ignore this entry if (citeKey == null || citeKey.equals("")) continue; if (first) { result.append(citeKey); first = false; } else { result.append(",").append(citeKey); } } return result.toString(); }
protected String getKeyString(BibtexEntry[] entries) { StringBuffer result = new StringBuffer(); String citeKey = "";//, message = ""; boolean first = true; for (int i=0; i<entries.length; i++) { BibtexEntry bes = entries[i]; citeKey = bes.getField(BibtexFields.KEY_FIELD); // if the key is empty we give a warning and ignore this entry if (citeKey == null || citeKey.equals("")) continue; if (first) { result.append(citeKey); first = false; } else { result.append(",").append(citeKey); } } return result.toString(); }
Clone fragments detected by clone detection tool
File path: /jabref-2.10/src/java/net/sf/jabref/BasePanel.java File path: /jabref-2.10/src/java/net/sf/jabref/external/PushToApplicationAction.java
Method name: String getKeysForSelection() Method name: String getKeyString(BibtexEntry[])
Number of AST nodes: 8 Number of AST nodes: 9
1
/**
1
protected String getKeyString(BibtexEntry[] entries) {
2
     * Get a String containing a comma-separated list of the bibtex keys
2
        StringBuffer result = new StringBuffer();
3
     * of the selected entries.
3
        String citeKey = "";//, message = "";
4
     *
4
        boolean first = true;
5
     * @return A comma-separated list of the keys of the selected entries.
5
        for (int i=0; i<entries.length; i++) {
6
     */
6
            BibtexEntry bes = entries[i];
7
    public String getKeysForSelection() {
7
            citeKey = bes.getField(BibtexFields.KEY_FIELD);
8
        StringBuffer result = new StringBuffer();
8
            // if the key is empty we give a warning and ignore this entry
9
        String citeKey = "";//, message = "";
9
            if (citeKey == null || citeKey.equals(""))
10
        boolean first = true;
10
                continue;
11
        for (BibtexEntry bes : mainTable.getSelected()){
11
            if (first) {
12
            citeKey = bes.getField(BibtexFields.KEY_FIELD);
12
                result.append(citeKey);
13
            // if the key is empty we give a warning and ignore this entry
13
                first = false;
14
            if (citeKey == null || citeKey.equals(""))
14
            } else {
15
                continue;
15
                result.append(",").append(citeKey);
16
            if (first) {
16
            }
17
                result.append(citeKey);
17
        }
18
                first = false;
18
        return result.toString();
19
            } else {
19
    }
20
                result.append(",").append(citeKey);
21
            }
22
        }
23
        return result.toString();
24
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.818
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (BibtexEntry bes : mainTable.getSelected())
    4
    for (BibtexEntry bes : mainTable.getSelected())
    4
    for (int i = 0; i < entries.length; i++)
    Differences
    Expression1Expression2Difference
    ca.odell.glazedlists.EventListnet.sf.jabref.BibtexEntry[]VARIABLE_TYPE_MISMATCH
    ca.odell.glazedlists.EventListnet.sf.jabref.BibtexEntry[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type ca.odell.glazedlists.EventList<net.sf.jabref.BibtexEntry> of variable mainTable.getSelected() does not match with type net.sf.jabref.BibtexEntry[] of variable entries
    • Make classes ca.odell.glazedlists.EventList and net.sf.jabref.BibtexEntry[] extend a common superclass
    Type ca.odell.glazedlists.EventList<net.sf.jabref.BibtexEntry> of variable mainTable.getSelected() does not match with type net.sf.jabref.BibtexEntry[] of variable entries
    • Make classes ca.odell.glazedlists.EventList and net.sf.jabref.BibtexEntry[] extend a common superclass
    4
    for (int i = 0; i < entries.length; i++)
                                                                
    5
    BibtexEntry bes = entries[i];
    Differences
    Expression1Expression2Difference
    ca.odell.glazedlists.EventListnet.sf.jabref.BibtexEntry[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type ca.odell.glazedlists.EventList<net.sf.jabref.BibtexEntry> of variable mainTable.getSelected() does not match with type net.sf.jabref.BibtexEntry[] of variable entries
    • Make classes ca.odell.glazedlists.EventList and net.sf.jabref.BibtexEntry[] extend a common superclass
    5
    BibtexEntry bes = entries[i];
    5
    citeKey = bes.getField(BibtexFields.KEY_FIELD);
    6
    citeKey = bes.getField(BibtexFields.KEY_FIELD);
    6
    if (citeKey == null || citeKey.equals(""))
    7
    if (citeKey == null || citeKey.equals(""))
    7
    continue;
    8
    continue;
    8
    if (first)
    9
    if (first)
    9
    result.append(citeKey);
    10
    result.append(citeKey);
    10
    first = false;
    11
    first = false;
    else
    else
    11
    result.append(",").append(citeKey);
    12
    result.append(",").append(citeKey);
    Precondition Violations (3)
    Row Violation
    1Type ca.odell.glazedlists.EventList<net.sf.jabref.BibtexEntry> of variable mainTable.getSelected() does not match with type net.sf.jabref.BibtexEntry[] of variable entries
    2Type ca.odell.glazedlists.EventList<net.sf.jabref.BibtexEntry> of variable mainTable.getSelected() does not match with type net.sf.jabref.BibtexEntry[] of variable entries
    3Type ca.odell.glazedlists.EventList<net.sf.jabref.BibtexEntry> of variable mainTable.getSelected() does not match with type net.sf.jabref.BibtexEntry[] of variable entries