try { waitSocket.getOutputStream().write('\0'); waitSocket.getOutputStream().flush(); waitSocket.getInputStream().close(); waitSocket.getOutputStream().close(); waitSocket.close(); } catch(IOException io) { //Log.log(Log.ERROR,this,io); }
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/org/gjt/sp/jedit/Buffer.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/io/FileVFS.java
Method name: void close() Method name: void setPermissions(String, int)
Number of AST nodes: 6 Number of AST nodes: 6
1
try
1
Str
2
ing[] cmdarray = { "chmod", Integer.toString(permissions, 8), path };
3
				try
2
			{
4
				{
3
				waitSocket.getOutputStream().write('\0');
5
					Process process = Runtime.getRuntime().exec(cmdarray);
4
				waitSocket.getOutputStream().flush();
6
					process.getInputStream().close();
5
				waitSocket.getInputStream().close();
7
					process.getOutputStream().close();
6
				waitSocket.getOutputStream().close();
8
					process.getErrorStream().close();
7
				waitSocket.close();
9
				
8
			}
9
			catch(IOException io)
10
			{
11
				//Log.log(Log.ERROR,this,io);
10
	// Jun 9 2004 12:40 PM
11
					// waitFor() hangs on some Java
12
					// implementations.
13
					/* int exitCode = process.waitFor();
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.
20
				catch (Throwable t)
21
				{
12
			}
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.2
Clones locationClones are in different classes
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)3.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                            
    5
    String[] cmdarray = {"chmod", Integer.toString(permissions, 8), path};
    5
    try
    5
    try
    6
    try
    Differences
    Expression1Expression2Difference
    java.io.IOExceptionjava.lang.ThrowableSUBCLASS_TYPE_MISMATCH
    iotVARIABLE_NAME_MISMATCH
    java.io.IOExceptionjava.lang.ThrowableSUBCLASS_TYPE_MISMATCH
    6
    try
    6
    waitSocket.getOutputStream().write('\0');
    6
    waitSocket.getOutputStream().write('\0');
    Preondition Violations
    Unmatched statement waitSocket.getOutputStream().write('\0'); 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);
    7
    waitSocket.getOutputStream().flush();
    7
    waitSocket.getOutputStream().flush();
    Preondition Violations
    Unmatched statement waitSocket.getOutputStream().flush(); 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
                                                                                    
    8
    waitSocket.getInputStream().close();
    8
    waitSocket.getInputStream().close();
    8
    process.getInputStream().close();
    Differences
    Expression1Expression2Difference
    waitSocketprocessVARIABLE_NAME_MISMATCH
    java.net.Socketjava.lang.ProcessVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.Socket of variable waitSocket does not match with type java.lang.Process of variable process
    • Make classes java.net.Socket and java.lang.Process extend a common superclass
    8
    process.getInputStream().close();
    9
    waitSocket.getOutputStream().close();
    9
    waitSocket.getOutputStream().close();
    9
    process.getOutputStream().close();
    Differences
    Expression1Expression2Difference
    waitSocketprocessVARIABLE_NAME_MISMATCH
    java.net.Socketjava.lang.ProcessVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.Socket of variable waitSocket does not match with type java.lang.Process of variable process
    • Make classes java.net.Socket and java.lang.Process extend a common superclass
    9
    process.getOutputStream().close();
                                                                              
    10
    process.getErrorStream().close();
    10
    waitSocket.close();
    10
    waitSocket.close();
    Preondition Violations
    Unmatched statement waitSocket.close(); 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
                                                  
    Precondition Violations (5)
    Row Violation
    1Unmatched statement waitSocket.getOutputStream().write('\0'); 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
    2Unmatched statement waitSocket.getOutputStream().flush(); 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
    3Type java.net.Socket of variable waitSocket does not match with type java.lang.Process of variable process
    4Type java.net.Socket of variable waitSocket does not match with type java.lang.Process of variable process
    5Unmatched statement waitSocket.close(); 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