if (lastJFCDirectory == null) { String start = JMeterUtils.getPropDefault("user.dir", ""); if (!start.equals("")) { jfc = new JFileChooser(new File(start)); } lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath(); } String ext = ".jmx"; if (filename != null) { jfc.setSelectedFile(new File(lastJFCDirectory, filename)); int i = -1; if ((i = filename.lastIndexOf(".")) > -1) { ext = filename.substring(i); } } clearFileFilters(); if (extensions != null) { jfc.addChoosableFileFilter(new JMeterFileFilter(extensions)); } else { jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] { ext })); } int retVal = jfc.showSaveDialog(ReportGuiPackage.getInstance().getMainFrame()); lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath(); if (retVal == JFileChooser.APPROVE_OPTION) { return jfc; } else { return null; }
if (lastJFCDirectory == null) { String start = JMeterUtils.getPropDefault("user.dir", "");//$NON-NLS-1$//$NON-NLS-2$ if (start.length() > 0) { jfc = new JFileChooser(new File(start)); } lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath(); } String ext = ".jmx";//$NON-NLS-1$ if (filename != null) { jfc.setSelectedFile(new File(lastJFCDirectory, filename)); int i = -1; if ((i = filename.lastIndexOf(".")) > -1) {//$NON-NLS-1$ ext = filename.substring(i); } } clearFileFilters(); if (extensions != null) { jfc.addChoosableFileFilter(new JMeterFileFilter(extensions)); } else { jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] { ext })); } int retVal = jfc.showSaveDialog(GuiPackage.getInstance().getMainFrame()); lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath(); if (retVal == JFileChooser.APPROVE_OPTION) { return jfc; } return null;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/ReportFileDialoger.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/FileDialoger.java
Method name: JFileChooser promptToSaveFile(String, String[]) Method name: JFileChooser promptToSaveFile(String, String[])
Number of AST nodes: 20 Number of AST nodes: 20
1
if (lastJFCDirectory == null) {
1
if (lastJFCDirectory == null) {
2
			String start = JMeterUtils.getPropDefault("user.dir", "");
2
			String start = JMeterUtils.getPropDefault("user.dir", "");//$NON-NLS-1$//$NON-NLS-2$
3
			if (!start.equals("")) {
3
			if (start.length() > 0) {
4
				jfc = new JFileChooser(new File(start));
4
				jfc = new JFileChooser(new File(start));
5
			}
5
			}
6
			lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
6
			lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
7
		}
7
		}
8
		String ext = ".jmx";
8
		String ext = ".jmx";//$NON-NLS-1$
9
		if (filename != null) {
9
		if (filename != null) {
10
			jfc.setSelectedFile(new File(lastJFCDirectory, filename));
10
			jfc.setSelectedFile(new File(lastJFCDirectory, filename));
11
			int i = -1;
11
			int i = -1;
12
			if ((i = filename.lastIndexOf(".")) > -1) {
12
			if ((i = filename.lastIndexOf(".")) > -1) {//$NON-NLS-1$
13
				ext = filename.substring(i);
13
				ext = filename.substring(i);
14
			}
14
			}
15
		}
15
		}
16
		clearFileFilters();
16
		clearFileFilters();
17
		if (extensions != null) {
17
		if (extensions != null) {
18
			jfc.addChoosableFileFilter(new JMeterFileFilter(extensions));
18
			jfc.addChoosableFileFilter(new JMeterFileFilter(extensions));
19
		} else {
19
		} else {
20
			jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] { ext }));
20
			jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] { ext }));
21
		}
21
		}
22
		int retVal = jfc.showSaveDialog(ReportGuiPackage.getInstance().getMainFrame());
22
		int retVal = jfc.showSaveDialog(GuiPackage.getInstance().getMainFrame());
23
		lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
23
		lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
24
		if (retVal == JFileChooser.APPROVE_OPTION) {
24
		if (retVal == JFileChooser.APPROVE_OPTION) {
25
			return jfc;
25
			return jfc;
26
		} else {
26
		}
27
			return null;
27
		return null;
28
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.8
Clones locationClones are in different classes
Number of node comparisons23
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment13
    Number of unmapped statements in the second code fragment13
    Time elapsed for statement mapping (ms)5.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                  
    1
    if (lastJFCDirectory == null)
                                                                                                                        
    2
    String start = JMeterUtils.getPropDefault("user.dir", "");
                                                      
    3
    if (start.length() > 0)
                                                                                      
    4
    jfc = new JFileChooser(new File(start));
    Preondition Violations
    Unmatched statement jfc=new JFileChooser(new File(start)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    jfc = new JFileChooser(new File(start));
                                                                                                                                    
    5
    lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
    Preondition Violations
    Unmatched statement lastJFCDirectory=jfc.getCurrentDirectory().getAbsolutePath(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
    1
    if (lastJFCDirectory == null)
                                                                  
    2
    String start = JMeterUtils.getPropDefault("user.dir", "");
                                                                                                                        
    3
    if (!start.equals(""))
                                                    
    4
    jfc = new JFileChooser(new File(start));
    4
    jfc = new JFileChooser(new File(start));
    Preondition Violations
    Unmatched statement jfc=new JFileChooser(new File(start)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                      
    5
    lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
    5
    lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
    Preondition Violations
    Unmatched statement lastJFCDirectory=jfc.getCurrentDirectory().getAbsolutePath(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                    
    6
    String ext = ".jmx";
    6
    String ext = ".jmx";
                                                  
    7
    if (filename != null)
                                                                                                                            
    8
    jfc.setSelectedFile(new File(lastJFCDirectory, filename));
    Preondition Violations
    Unmatched statement jfc.setSelectedFile(new File(lastJFCDirectory,filename)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8
    jfc.setSelectedFile(new File(lastJFCDirectory, filename));
                            
    9
    int i = -1;
                                                                                        
    10
    if ((i = filename.lastIndexOf(".")) > -1)
    7
    if (filename != null)
                                                  
    8
    jfc.setSelectedFile(new File(lastJFCDirectory, filename));
    8
    jfc.setSelectedFile(new File(lastJFCDirectory, filename));
    Preondition Violations
    Unmatched statement jfc.setSelectedFile(new File(lastJFCDirectory,filename)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                            
    9
    int i = -1;
                            
    10
    if ((i = filename.lastIndexOf(".")) > -1)
                                                                                        
    10
    if ((i = filename.lastIndexOf(".")) > -1)
    10
    if ((i = filename.lastIndexOf(".")) > -1)
                                                                
    11
    ext = filename.substring(i);
    Preondition Violations
    Unmatched statement ext=filename.substring(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    ext = filename.substring(i);
    11
    ext = filename.substring(i);
    11
    ext = filename.substring(i);
    Preondition Violations
    Unmatched statement ext=filename.substring(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
    11
    ext = filename.substring(i);
    11
    ext = filename.substring(i);
    12
    clearFileFilters();
    12
    clearFileFilters();
                                                        
    13
    if (extensions != null)
                                                                                                                                      
    14
    jfc.addChoosableFileFilter(new JMeterFileFilter(extensions));
    Preondition Violations
    Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(extensions)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    14
    jfc.addChoosableFileFilter(new JMeterFileFilter(extensions));
            
    else
                                                                                                                                                    
    15
    jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] {ext}));
    Preondition Violations
    Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(new String[]{ext})); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] {ext}));
    13
    if (extensions != null)
                                                        
    14
    jfc.addChoosableFileFilter(new JMeterFileFilter(extensions));
    14
    jfc.addChoosableFileFilter(new JMeterFileFilter(extensions));
    Preondition Violations
    Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(extensions)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                      
    else
            
    15
    jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] {ext}));
    15
    jfc.addChoosableFileFilter(new JMeterFileFilter(new String[] {ext}));
    Preondition Violations
    Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(new String[]{ext})); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                    
    Precondition Violations (13)
    Row Violation
    1Unmatched statement jfc=new JFileChooser(new File(start)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement lastJFCDirectory=jfc.getCurrentDirectory().getAbsolutePath(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement jfc=new JFileChooser(new File(start)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement lastJFCDirectory=jfc.getCurrentDirectory().getAbsolutePath(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement jfc.setSelectedFile(new File(lastJFCDirectory,filename)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement jfc.setSelectedFile(new File(lastJFCDirectory,filename)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement ext=filename.substring(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement ext=filename.substring(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(extensions)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(new String[]{ext})); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(extensions)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12Unmatched statement jfc.addChoosableFileFilter(new JMeterFileFilter(new String[]{ext})); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Clone fragment #1 returns variables ext, i , while Clone fragment #2 returns variables ext, i