Process proc = Runtime.getRuntime().exec(args); proc.getInputStream().close(); proc.getOutputStream().close(); proc.getErrorStream().close(); try { proc.waitFor(); } catch(InterruptedException ie) { }
String[] cmdarray = { "chmod", Integer.toString(permissions, 8), path }; try { Process process = Runtime.getRuntime().exec(cmdarray); process.getInputStream().close(); process.getOutputStream().close(); process.getErrorStream().close(); // Jun 9 2004 12:40 PM // waitFor() hangs on some Java // implementations. /* int exitCode = process.waitFor(); if(exitCode != 0) Log.log(Log.NOTICE,FileVFS.class,"chmod exited with code " + exitCode); */ } // Feb 4 2000 5:30 PM // Catch Throwable here rather than Exception. // Kaffe's implementation of Runtime.exec throws java.lang.InternalError. catch (Throwable t) { }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/installer/OperatingSystem.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/io/FileVFS.java
Method name: void exec(String[]) Method name: void setPermissions(String, int)
Number of AST nodes: 6 Number of AST nodes: 6
1
String[] cmdarray = { "chmod", Integer.toString(permissions, 8), path };
2
				try
3
				{
1
Process proc = Runtime.getRuntime().exec(args);
4
					Process process = Runtime.getRuntime().exec(cmdarray);
2
			proc.getInputStream().close();
5
					process.getInputStream().close();
3
			proc.getOutputStream().close();
6
					process.getOutputStream().close();
4
			proc.getErrorStream().close();
7
					process.getErrorStream().close();
5
			try
8
			
6
			{
7
				
9
		// Jun 9 2004 12:40 PM
10
					// waitFor() hangs on some Java
11
					// implementations.
8
proc.waitFor();
12
					/* int exitCode = process.waitFor();
9
			}
13
				
10
			catch(InterruptedException ie
14
	if(exitCode != 0)
15
						Log.log(Log.NOTICE,FileVFS.class,"chmod exited with code " + exitCode); */
16
				}
17
				// Feb 4 2000 5:30 PM
18
				// Catch Throwable here rather than Exception.
19
				// Kaffe's implementation of Runtime.exec throws java.lang.InternalError.
11
)
20
				catch (Throwable t)
12
			{
21
				{
13
			}
22
				}
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)0.1
Clones locationClones are in different classes
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Process proc = Runtime.getRuntime().exec(args);
                                                                                                    
    2
    proc.getInputStream().close();
                                                                      
    3
    proc.getOutputStream().close();
                                                                        
    4
    proc.getErrorStream().close();
                                                                      
                                                                                                                                            
    5
    String[] cmdarray = {"chmod", Integer.toString(permissions, 8), path};
    5
    try
    5
    try
    6
    try
    Differences
    Expression1Expression2Difference
    java.lang.InterruptedExceptionjava.lang.ThrowableSUBCLASS_TYPE_MISMATCH
    ietVARIABLE_NAME_MISMATCH
    java.lang.InterruptedExceptionjava.lang.ThrowableSUBCLASS_TYPE_MISMATCH
    6
    try
    6
    proc.waitFor();
    6
    proc.waitFor();
    Preondition Violations
    Unmatched statement proc.waitFor(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                        
                                                                                                                  
    7
    Process process = Runtime.getRuntime().exec(cmdarray);
                                                                            
    8
    process.getInputStream().close();
                                                                              
    9
    process.getOutputStream().close();
                                                                              
    10
    process.getErrorStream().close();
    Precondition Violations (1)
    Row Violation
    1Unmatched statement proc.waitFor(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted