public void send(String in) throws Exception { inputStream.write(in.getBytes()); inputStream.flush(); inputStream.close(); } public void send(InputStream in) throws Exception { StreamUtils.streamCopy(in, inputStream); inputStream.flush(); inputStream.close(); } public int waitFor() throws Exception { int exitVal = p.waitFor(); return exitVal; } /** * * return error * * @return * @throws Exception */ public String getErrorString() throws Exception { String str = errorStream.getBuffer(); return str; } /** * * return output * * @return * @throws Exception */ public String getOutputString() throws Exception { String str = outputStream.getBuffer(); return str; } /* * wait for stream threads to die * */ public void waitForThreads() throws Exception { outputStream.join(); errorStream.join(); } public class StreamThread extends Thread { InputStream is; StringBuffer buf; public StreamThread(InputStream theInputStream) { this.is = theInputStream; buf = new StringBuffer(); } @Override public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { LOG.info(">" + line); //$NON-NLS-1$ buf.append(line + "\n"); //$NON-NLS-1$ } } catch (IOException ioe) { ioe.printStackTrace(); } } public String getBuffer() { return buf.toString()
public void send(String in) throws Exception { inputStream.write(in.getBytes()); inputStream.flush(); inputStream.close(); } public void send(InputStream in) throws Exception { StreamUtils.streamCopy(in, inputStream); inputStream.flush(); inputStream.close(); } public int waitFor() throws Exception { int exitVal = p.waitFor(); return exitVal; } /** * * return error * * @return @throws * Exception */ public String getErrorString() throws Exception { String str = errorStream.getBuffer(); return str; } /** * * return output * * @return @throws * Exception */ public String getOutputString() throws Exception { String str = outputStream.getBuffer(); return str; } /* * wait for stream threads to die * */ public void waitForThreads() throws Exception { outputStream.join(); errorStream.join(); } public class StreamThread extends Thread { InputStream is; StringBuffer buf; public StreamThread(InputStream is) { this.is = is; buf = new StringBuffer(); } public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { LOG.info(">" + line); //$NON-NLS-1$ buf.append(line + "\n"); } } catch (IOException ioe) { ioe.printStackTrace(); } } public String getBuffer() { return buf.toString()
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/base/IPCHelper.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/spam/spamassassin/IPCHelper.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public void send(String in) throws Exception {
1
public void send(String in) throws Exception {
2
	inputStream.write(in.getBytes());
2
        inputStream.write(in.getBytes());
3
	inputStream.flush();
3
        inputStream.flush();
4
	inputStream.close();
4
        inputStream.close();
5
    }
5
    }
6
    public void send(InputStream in) throws Exception {
6
    public void send(InputStream in) throws Exception {
7
	StreamUtils.streamCopy(in, inputStream);
7
        StreamUtils.streamCopy(in, inputStream);
8
	inputStream.flush();
8
        inputStream.flush();
9
	inputStream.close();
9
        inputStream.close();
10
    }
10
    }
11
    public int waitFor() throws Exception {
11
    public int waitFor() throws Exception {
12
	int exitVal = p.waitFor();
12
        int exitVal = p.waitFor();
13
	return exitVal;
13
        return exitVal;
14
    }
14
    }
15
    /**
15
    /**
16
         * 
16
     
17
    
17
*
18
     * return error
18
     * return error
19
         * 
19
     *
20
    
21
     * @return
20
     * @return @throws
22
         * @throws Exception
21
     *         Exception
23
         */
22
     */
24
    public String getErrorString() throws Exception {
23
    public String getErrorString() throws Exception {
25
	String str = errorStream.getBuffer();
24
        String str = errorStream.getBuffer();
26
	return str;
25
        return str;
27
    }
26
    }
28
    /**
27
    /**
29
         * 
28
     *
30
    
31
     * return output
29
     * return output
32
         * 
30
     *
33
    
34
     * @return
31
     * @return
35
         * @throws
32
 @throws
36
 Exception
33
     *         Exception
37
         */
34
     */
38
    public String getOutputString() throws Exception {
35
    public String getOutputString() throws Exception {
39
	String str = outputStream.getBuffer();
36
        String str = outputStream.getBuffer();
40
	return str;
37
        return str;
41
    }
38
    }
42
    /*
39
    /*
43
         * wait for stream threads to die
40
     * wait for stream threads to die
44
         * 
41
     
45
   
42
*
46
      */
43
     */
47
    public void waitForThreads() throws Exception {
44
    public void waitForThreads() throws Exception {
48
	outputStream.join();
45
        outputStream.join();
49
	errorStream.join();
46
        errorStream.join();
50
    }
47
    }
51
    public class StreamThread extends Thread {
48
    public class StreamThread extends Thread {
52
	InputStream is;
49
        InputStream is;
53
	StringBuffer buf;
50
        StringBuffer buf;
54
	public StreamThread(InputStream theInputStream) {
51
        public StreamThread(InputStream 
55
	    this.is = theInputStream;
56
	
52
is) {
53
            this.is = is;
57
    buf = new StringBuffer();
54
            buf = new StringBuffer();
58
	}
59
	@Override
60
	
55
        }
61
public void run() {
56
        public void run() {
62
	    try {
57
            try {
63
		InputStreamReader isr = new InputStreamReader(is);
58
                InputStreamReader isr = new InputStreamReader(is);
64
		BufferedReader br = new BufferedReader(isr);
59
                BufferedReader br = new BufferedReader(isr);
65
		String line = null;
60
                String line = null;
66
		while ((line = br.readLine()) != null) {
61
                while ((line = br.readLine()) != null) {
67
		    LOG.info(">" + line); //$NON-NLS-1$
62
                    LOG.info(">" + line); //$NON-NLS-1$
68
		    buf.append(line + "\n"); //$NON-NLS-1$
63
                    buf.append(line + "\n");
69
		}
70
	
64
                }
71
    } catch (IOException ioe) {
65
            } catch (IOException ioe) {
72
		ioe.printStackTrace();
66
                ioe.printStackTrace();
73
	    }
74
	}
75
	
67
            }
68
        }
76
public String getBuffer() {
69
        public String getBuffer() {
77
	    return buf.toString()
70
            return buf.toString()
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0