File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/command/CopyEventCommand.java | File path: /columba-1.4-src/plugins/org.columba.chat.altura/src/org/columba/chat/command/AddContactCommand.java | |||
Method name: void execute(IWorkerStatusController)
|
Method name: void execute(IWorkerStatusController)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | try {↵ | |||
2 | // retrieve event from store↵ | |||
3 | IEventInfo event = (IEventInfo) store.get(eventItem.getId());↵ | |||
4 | IEventInfo copy = (IEventInfo) event.createCopy();↵ | |||
5 | // set new calendar id↵ | |||
6 | copy.setCalendar(calendar.getId());↵ | |||
7 | // persist modified calendar↵ | |||
8 | store.add(copy↵ | 1 | ChatCommandReference ref = (ChatCommandReference) getReference();↵ | |
2 | try {↵ | |||
3 | String jabberId = ref.getJabberId();↵ | |||
4 | // add contact to roaster, nickname="", group=null↵ | |||
5 | Connection.XMPPConnection.getRoster().createEntry(jabberId,↵ | |||
6 | "", null);↵ | |||
9 | );↵ | 7 | populateCommand.execute(worker);↵ | |
10 | } catch (StoreException e1) {↵ | 8 | } catch (XMPPException e) {↵ | |
11 | JOptionPane.showMessageDialog(FrameManager.getInstance()↵ | 9 | JOptionPane.showMessageDialog(FrameManager.getInstance()↵ | |
12 | .getActiveFrame(), e1.getMessage());↵ | 10 | .getActiveFrame(), e.getMessage());↵ | |
13 | e1.printStackTrace();↵ | 11 | e.printStackTrace();↵ | |
14 | } | 12 |
| |
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.5 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 20 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 2.1 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | ChatCommandReference ref = (ChatCommandReference)getReference(); | ||||||||||||||||||||||||||||||
4 | try |
| 2 | try | ||||||||||||||||||||||||||||
| 3 | String jabberId = ref.getJabberId(); | ||||||||||||||||||||||||||||||
|
| 4 | Connection.XMPPConnection.getRoster().createEntry(jabberId, "", null); | |||||||||||||||||||||||||||||
|
| 5 | populateCommand.execute(worker); | |||||||||||||||||||||||||||||
5 | IEventInfo event = (IEventInfo)store.get(eventItem.getId()); |
| | |||||||||||||||||||||||||||||
6 | IEventInfo copy = (IEventInfo)event.createCopy(); | | ||||||||||||||||||||||||||||||
7 | copy.setCalendar(calendar.getId()); | | ||||||||||||||||||||||||||||||
8 | store.add(copy); |
| |
Row | Violation |
---|---|
1 | Unmatched statement Connection.XMPPConnection.getRoster().createEntry(jabberId,"",null); 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 |
2 | Unmatched statement populateCommand.execute(worker); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement populateCommand.execute(worker); 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 |
4 | Unmatched statement IEventInfo event=(IEventInfo)store.get(eventItem.getId()); 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 |
5 | Unmatched statement store.add(copy); 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 |