String settingsDirectory = jEdit.getSettingsDirectory(); if(settingsDirectory == null) return; File recent = new File(MiscUtilities.constructPath( settingsDirectory,"recent.xml")); if(!recent.exists()) return; recentModTime = recent.lastModified(); Log.log(Log.MESSAGE,BufferHistory.class,"Loading recent.xml"); RecentHandler handler = new RecentHandler(); XmlParser parser = new XmlParser(); Reader in = null; parser.setHandler(handler); try { in = new BufferedReader(new FileReader(recent)); parser.parse(null, null, in); } catch(XmlException xe) { int line = xe.getLine(); String message = xe.getMessage(); Log.log(Log.ERROR,BufferHistory.class,recent + ":" + line + ": " + message); } catch(FileNotFoundException fnf) { //Log.log(Log.DEBUG,BufferHistory.class,fnf); } catch(Exception e) { Log.log(Log.ERROR,BufferHistory.class,e); } finally { try { if(in != null) in.close(); } catch(IOException io) { Log.log(Log.ERROR,BufferHistory.class,io); } }
String settingsDirectory = jEdit.getSettingsDirectory(); if(settingsDirectory == null) return; File killRing = new File(MiscUtilities.constructPath( settingsDirectory,"killring.xml")); if(!killRing.exists()) return; killRingModTime = killRing.lastModified(); Log.log(Log.MESSAGE,KillRing.class,"Loading killring.xml"); KillRingHandler handler = new KillRingHandler(); XmlParser parser = new XmlParser(); Reader in = null; parser.setHandler(handler); try { in = new BufferedReader(new FileReader(killRing)); parser.parse(null, null, in); } catch(XmlException xe) { int line = xe.getLine(); String message = xe.getMessage(); Log.log(Log.ERROR,KillRing.class,killRing + ":" + line + ": " + message); } catch(FileNotFoundException fnf) { //Log.log(Log.DEBUG,BufferHistory.class,fnf); } catch(Exception e) { Log.log(Log.ERROR,KillRing.class,e); } finally { try { if(in != null) in.close(); } catch(IOException io) { Log.log(Log.ERROR,KillRing.class,io); } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/BufferHistory.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/buffer/KillRing.java
Method name: void load() Method name: void load()
Number of AST nodes: 15 Number of AST nodes: 15
1
String settingsDirectory = jEdit.getSettingsDirectory();
1
String settingsDirectory = jEdit.getSettingsDirectory();
2
		if(settingsDirectory == null)
2
		if(settingsDirectory == null)
3
			return;
3
			return;
4
		File recent = new File(MiscUtilities.constructPath(
4
		File killRing = new File(MiscUtilities.constructPath(
5
			settingsDirectory,"recent.xml"));
5
			settingsDirectory,"killring.xml"));
6
		if(!recent.exists())
6
		if(!killRing.exists())
7
			return;
7
			return;
8
		recentModTime = recent.lastModified();
8
		killRingModTime = killRing.lastModified();
9
		Log.log(Log.MESSAGE,BufferHistory.class,"Loading recent.xml");
9
		Log.log(Log.MESSAGE,KillRing.class,"Loading killring.xml");
10
		RecentHandler handler = new RecentHandler();
10
		KillRingHandler handler = new KillRingHandler();
11
		XmlParser parser = new XmlParser();
11
		XmlParser parser = new XmlParser();
12
		Reader in = null;
12
		Reader in = null;
13
		parser.setHandler(handler);
13
		parser.setHandler(handler);
14
		try
14
		try
15
		{
15
		{
16
			in = new BufferedReader(new FileReader(recent));
16
			in = new BufferedReader(new FileReader(killRing));
17
			parser.parse(null, null, in);
17
			parser.parse(null, null, in);
18
		}
18
		}
19
		catch(XmlException xe)
19
		catch(XmlException xe)
20
		{
20
		{
21
			int line = xe.getLine();
21
			int line = xe.getLine();
22
			String message = xe.getMessage();
22
			String message = xe.getMessage();
23
			Log.log(Log.ERROR,BufferHistory.class,recent + ":" + line
23
			Log.log(Log.ERROR,KillRing.class,killRing + ":" + line
24
				+ ": " + message);
24
				+ ": " + message);
25
		}
25
		}
26
		catch(FileNotFoundException fnf)
26
		catch(FileNotFoundException fnf)
27
		{
27
		{
28
			//Log.log(Log.DEBUG,BufferHistory.class,fnf);
28
			//Log.log(Log.DEBUG,BufferHistory.class,fnf);
29
		}
29
		}
30
		catch(Exception e)
30
		catch(Exception e)
31
		{
31
		{
32
			Log.log(Log.ERROR,BufferHistory.class,e);
32
			Log.log(Log.ERROR,KillRing.class,e);
33
		}
33
		}
34
		finally
34
		finally
35
		{
35
		{
36
			try
36
			try
37
			{
37
			{
38
				if(in != null)
38
				if(in != null)
39
					in.close();
39
					in.close();
40
			}
40
			}
41
			catch(IOException io)
41
			catch(IOException io)
42
			{
42
			{
43
				Log.log(Log.ERROR,BufferHistory.class,io);
43
				Log.log(Log.ERROR,KillRing.class,io);
44
			}
44
			}
45
		}
45
		}
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 comparisons62
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String settingsDirectory = jEdit.getSettingsDirectory();
    1
    String settingsDirectory = jEdit.getSettingsDirectory();
    2
    if (settingsDirectory == null)
    2
    if (settingsDirectory == null)
    3
    return;
    3
    return;
    3
    return;
    Preondition Violations
    Conditional return;
    3
    return;
    4
    File recent = new File(MiscUtilities.constructPath(settingsDirectory, "recent.xml"));
    4
    File recent = new File(MiscUtilities.constructPath(settingsDirectory, "recent.xml"));
    4
    File killRing = new File(MiscUtilities.constructPath(settingsDirectory, "killring.xml"));
    Differences
    Expression1Expression2Difference
    recentkillRingVARIABLE_NAME_MISMATCH
    "recent.xml""killring.xml"LITERAL_VALUE_MISMATCH
    4
    File killRing = new File(MiscUtilities.constructPath(settingsDirectory, "killring.xml"));
    5
    if (!recent.exists())
    5
    if (!recent.exists())
    5
    if (!killRing.exists())
    Differences
    Expression1Expression2Difference
    recentkillRingVARIABLE_NAME_MISMATCH
    5
    if (!killRing.exists())
    6
    return;
    6
    return;
    6
    return;
    Preondition Violations
    Conditional return;
    6
    return;
    7
    recentModTime = recent.lastModified();
    7
    recentModTime = recent.lastModified();
    7
    killRingModTime = killRing.lastModified();
    Differences
    Expression1Expression2Difference
    recentModTimekillRingModTimeVARIABLE_NAME_MISMATCH
    recentkillRingVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression recentModTime is a field being modified, and thus it cannot be parameterized
    Expression killRingModTime is a field being modified, and thus it cannot be parameterized
    7
    killRingModTime = killRing.lastModified();
    8
    Log.log(Log.MESSAGE, BufferHistory.class, "Loading recent.xml");
    8
    Log.log(Log.MESSAGE, KillRing.class, "Loading killring.xml");
    9
    RecentHandler handler = new RecentHandler();
    9
    RecentHandler handler = new RecentHandler();
    9
    KillRingHandler handler = new KillRingHandler();
    Differences
    Expression1Expression2Difference
    org.gjt.sp.jedit.BufferHistory.RecentHandlerorg.gjt.sp.jedit.buffer.KillRing.KillRingHandlerSUBCLASS_TYPE_MISMATCH
    org.gjt.sp.jedit.BufferHistory.RecentHandlerorg.gjt.sp.jedit.buffer.KillRing.KillRingHandlerSUBCLASS_TYPE_MISMATCH
    org.gjt.sp.jedit.BufferHistory.RecentHandlerorg.gjt.sp.jedit.buffer.KillRing.KillRingHandlerSUBCLASS_TYPE_MISMATCH
    9
    KillRingHandler handler = new KillRingHandler();
    10
    XmlParser parser = new XmlParser();
    10
    XmlParser parser = new XmlParser();
    11
    Reader in = null;
    11
    Reader in = null;
    12
    parser.setHandler(handler);
    12
    parser.setHandler(handler);
    12
    parser.setHandler(handler);
    Differences
    Expression1Expression2Difference
    org.gjt.sp.jedit.BufferHistory.RecentHandlerorg.gjt.sp.jedit.buffer.KillRing.KillRingHandlerSUBCLASS_TYPE_MISMATCH
    12
    parser.setHandler(handler);
    13
    try
    13
    try
    14
    in = new BufferedReader(new FileReader(recent));
    14
    in = new BufferedReader(new FileReader(recent));
    14
    in = new BufferedReader(new FileReader(killRing));
    Differences
    Expression1Expression2Difference
    recentkillRingVARIABLE_NAME_MISMATCH
    14
    in = new BufferedReader(new FileReader(killRing));
    15
    parser.parse(null, null, in);
    15
    parser.parse(null, null, in);
    Precondition Violations (5)
    Row Violation
    1Conditional return;
    2Conditional return;
    3Expression recentModTime is a field being modified, and thus it cannot be parameterized
    4Expression killRingModTime is a field being modified, and thus it cannot be parameterized
    5Clone fragment #1 returns variables , while Clone fragment #2 returns variables handler