File path: /jEdit-4.2/src/org/gjt/sp/jedit/BufferHistory.java | File path: /jEdit-4.2/src/org/gjt/sp/jedit/jEdit.java | |||
Method name: void load()
|
Method name: void loadModeCatalog(String, boolean)
|
|||
Number of AST nodes: 15 | Number of AST nodes: 12 | |||
1 | String settingsDirectory = jEdit.getSettingsDirectory();↵ | |||
2 | if(settingsDirectory == null)↵ | |||
3 | return;↵ | |||
4 | File recent = new File(MiscUtilities.constructPath(↵ | |||
5 | settingsDirectory,"recent.xml"));↵ | |||
6 | if(!recent.exists())↵ | |||
7 | return;↵ | |||
8 | recentModTime = recent.lastModified();↵ | |||
9 | Log.log(Log.MESSAGE,BufferHistory.class,"Loading recent.xml");↵ | 1 | Log.log(Log.MESSAGE,jEdit.class,"Loading ↵ | |
10 | RecentHandler handler = new RecentHandler(↵ | 2 | mode catalog file " + path);↵ | |
3 | ModeCatalogHandler handler = new ModeCatalogHandler(↵ | |||
11 | );↵ | 4 | MiscUtilities.getParentOfPath(path),resource);↵ | |
12 | XmlParser parser = new XmlParser();↵ | 5 | XmlParser parser = new XmlParser();↵ | |
13 | Reader in = null;↵ | 6 | ↵ | |
14 | parser.setHandler(handler↵ | 7 | parser.setHandler(handler);↵ | |
8 | Reader in = null;↵ | |||
9 | try↵ | |||
10 | {↵ | |||
11 | InputStream _in;↵ | |||
12 | if(resource)↵ | |||
15 | );↵ | 13 | _in = jEdit.class.getResourceAsStream(path);↵ | |
16 | try↵ | 14 | ↵ | |
17 | {↵ | 15 | else↵ | |
16 | _in = new FileInputStream(path);↵ | |||
18 | in = new BufferedReader(new FileReader(recent));↵ | 17 | in = new BufferedReader(new InputStreamReader(_in));↵ | |
19 | parser.parse(null, null, in);↵ | 18 | parser.parse(null, null, in);↵ | |
20 | }↵ | 19 | }↵ | |
21 | catch(XmlException xe)↵ | 20 | catch(XmlException xe)↵ | |
22 | {↵ | 21 | {↵ | |
23 | int line = xe.getLine();↵ | 22 | int line = xe.getLine();↵ | |
24 | String message = xe.getMessage();↵ | 23 | String message = xe.getMessage();↵ | |
25 | Log.log(Log.ERROR,BufferHistory.class,recent + ":" + line↵ | 24 | Log.log(Log.ERROR,jEdit.class,path + ":" + line↵ | |
26 | + ": " + message);↵ | 25 | + ": " + message);↵ | |
27 | }↵ | 26 | }↵ | |
28 | catch(FileNotFoundException fnf)↵ | 27 | ↵ | |
29 | {↵ | |||
30 | //Log.log(Log.DEBUG,BufferHistory.class,fnf);↵ | |||
31 | }↵ | |||
32 | catch(Exception e)↵ | 28 | catch(Exception e)↵ | |
33 | {↵ | 29 | {↵ | |
34 | Log.log(Log.ERROR,BufferHistory.class,e);↵ | 30 | Log.log(Log.ERROR,jEdit.class,e);↵ | |
35 | }↵ | 31 | }↵ | |
36 | finally↵ | 32 | finally↵ | |
37 | {↵ | 33 | {↵ | |
38 | try↵ | 34 | try↵ | |
39 | {↵ | 35 | {↵ | |
40 | if(in != null)↵ | 36 | if(in != null)↵ | |
41 | in.close();↵ | 37 | in.close();↵ | |
42 | }↵ | 38 | }↵ | |
43 | catch(IOException io)↵ | 39 | catch(IOException io)↵ | |
44 | {↵ | 40 | {↵ | |
45 | Log.log(Log.ERROR,BufferHistory.class,io);↵ | 41 | Log.log(Log.ERROR,jEdit.class,io);↵ | |
46 | }↵ | 42 | }↵ | |
47 | } | 43 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 10 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | String settingsDirectory = jEdit.getSettingsDirectory(); | | ||||||||||||
2 | if (settingsDirectory == null) | | ||||||||||||
3 | return; |
| | |||||||||||
4 | File recent = new File(MiscUtilities.constructPath(settingsDirectory, "recent.xml")); | | ||||||||||||
5 | if (!recent.exists()) |
| 8 | if (resource) | ||||||||||
6 | return; |
| | |||||||||||
|
| 9 | _in = jEdit.class.getResourceAsStream(path); | |||||||||||
| else | |||||||||||||
|
| 10 | _in = new FileInputStream(path); |
Row | Violation |
---|---|
1 | Unmatched return; |
2 | Unmatched return; |
3 | Unmatched statement _in=jEdit.class.getResourceAsStream(path); cannot be moved, because it updates a variable modified in other unmapped statements |
4 | Unmatched statement _in=new FileInputStream(path); cannot be moved, because it updates a variable modified in other unmapped statements |