SaveGraphicsService save = new SaveGraphicsService(); String ext = filename.substring(filename.length() - 4); String name = filename.substring(0, filename.length() - 4); if (ext.equals(SaveGraphicsService.PNG_EXTENSION)) { save.saveJComponent(name, SaveGraphicsService.PNG, comp); } else if (ext.equals(SaveGraphicsService.TIFF_EXTENSION)) { save.saveJComponent(name, SaveGraphicsService.TIFF, comp); } else { save.saveJComponent(filename, SaveGraphicsService.PNG, comp); }
SaveGraphicsService save = new SaveGraphicsService(); String ext = filename.substring(filename.length() - 4); String name = filename.substring(0, filename.length() - 4); if (ext.equals(SaveGraphicsService.PNG_EXTENSION)) { save.saveJComponent(name, SaveGraphicsService.PNG, comp); } else if (ext.equals(SaveGraphicsService.TIFF_EXTENSION)) { save.saveJComponent(name, SaveGraphicsService.TIFF, comp); } else { save.saveJComponent(filename, SaveGraphicsService.PNG, comp); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/action/ReportSaveGraphics.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/SaveGraphics.java
Method name: void doAction(ActionEvent) Method name: void saveImage(JComponent)
Number of AST nodes: 8 Number of AST nodes: 8
1
SaveGraphicsService save = new SaveGraphicsService();
1
SaveGraphicsService save = new SaveGraphicsService();
2
					String ext = filename.substring(filename.length() - 4);
2
            String ext = filename.substring(filename.length() - 4);
3
					String name = filename.substring(0, filename.length() - 4);
3
            String name = filename.substring(0, filename.length() - 4);
4
					if (ext.equals(SaveGraphicsService.PNG_EXTENSION)) {
4
            if (ext.equals(SaveGraphicsService.PNG_EXTENSION)) {
5
						save.saveJComponent(name, SaveGraphicsService.PNG, comp);
5
                save.saveJComponent(name, SaveGraphicsService.PNG, comp);
6
					} else if (ext.equals(SaveGraphicsService.TIFF_EXTENSION)) {
6
            } else if (ext.equals(SaveGraphicsService.TIFF_EXTENSION)) {
7
						save.saveJComponent(name, SaveGraphicsService.TIFF, comp);
7
                save.saveJComponent(name, SaveGraphicsService.TIFF, comp);
8
					} else {
9
						
8
            } else {
10
save.saveJComponent(filename, SaveGraphicsService.PNG, comp);
9
                save.saveJComponent(filename, SaveGraphicsService.PNG, comp);
11
					}
10
            }
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.6
Clones locationClones are in different classes
Number of node comparisons26
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    15
    SaveGraphicsService save = new SaveGraphicsService();
    12
    SaveGraphicsService save = new SaveGraphicsService();
    16
    String ext = filename.substring(filename.length() - 4);
    13
    String ext = filename.substring(filename.length() - 4);
    17
    String name = filename.substring(0, filename.length() - 4);
    14
    String name = filename.substring(0, filename.length() - 4);
    18
    if (ext.equals(SaveGraphicsService.PNG_EXTENSION))
    15
    if (ext.equals(SaveGraphicsService.PNG_EXTENSION))
    19
    save.saveJComponent(name, SaveGraphicsService.PNG, comp);
    16
    save.saveJComponent(name, SaveGraphicsService.PNG, comp);
    20
    else if (ext.equals(SaveGraphicsService.TIFF_EXTENSION))
    17
    else if (ext.equals(SaveGraphicsService.TIFF_EXTENSION))
    21
    save.saveJComponent(name, SaveGraphicsService.TIFF, comp);
    18
    save.saveJComponent(name, SaveGraphicsService.TIFF, comp);
    else
    else
    22
    save.saveJComponent(filename, SaveGraphicsService.PNG, comp);
    19
    save.saveJComponent(filename, SaveGraphicsService.PNG, comp);
    Precondition Violations (0)
    Row Violation