try { // retrieve event from store IEventInfo event = (IEventInfo) store.get(eventItem.getId()); IEventInfo copy = (IEventInfo) event.createCopy(); // set new calendar id copy.setCalendar(calendar.getId()); // persist modified calendar store.add(copy); } catch (StoreException e1) { JOptionPane.showMessageDialog(FrameManager.getInstance() .getActiveFrame(), e1.getMessage()); e1.printStackTrace(); }
ChatCommandReference ref = (ChatCommandReference) getReference(); try { String jabberId = ref.getJabberId(); // add contact to roaster, nickname="", group=null Connection.XMPPConnection.getRoster().createEntry(jabberId, "", null); populateCommand.execute(worker); } catch (XMPPException e) { JOptionPane.showMessageDialog(FrameManager.getInstance() .getActiveFrame(), e.getMessage()); e.printStackTrace(); }
Clone fragments detected by clone detection tool
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
		}
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                      
    1
    ChatCommandReference ref = (ChatCommandReference)getReference();
    4
    try
    4
    try
    2
    try
    Differences
    Expression1Expression2Difference
    org.columba.calendar.store.api.StoreExceptionorg.jivesoftware.smack.XMPPExceptionSUBCLASS_TYPE_MISMATCH
    e1eVARIABLE_NAME_MISMATCH
    org.columba.calendar.store.api.StoreExceptionorg.jivesoftware.smack.XMPPExceptionSUBCLASS_TYPE_MISMATCH
    e1eVARIABLE_NAME_MISMATCH
    org.columba.calendar.store.api.StoreExceptionorg.jivesoftware.smack.XMPPExceptionSUBCLASS_TYPE_MISMATCH
    e1eVARIABLE_NAME_MISMATCH
    org.columba.calendar.store.api.StoreExceptionorg.jivesoftware.smack.XMPPExceptionSUBCLASS_TYPE_MISMATCH
    2
    try
                                                                              
    3
    String jabberId = ref.getJabberId();
                                                                                                                                                  
    4
    Connection.XMPPConnection.getRoster().createEntry(jabberId, "", null);
                                                                          
    5
    populateCommand.execute(worker);
    Preondition Violations
    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
    5
    populateCommand.execute(worker);
    5
    IEventInfo event = (IEventInfo)store.get(eventItem.getId());
    5
    IEventInfo event = (IEventInfo)store.get(eventItem.getId());
    Preondition Violations
    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
                                                                                                                              
    6
    IEventInfo copy = (IEventInfo)event.createCopy();
                                                                                                        
    7
    copy.setCalendar(calendar.getId());
                                                                                
    8
    store.add(copy);
    8
    store.add(copy);
    Preondition Violations
    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
                                          
    Precondition Violations (3)
    Row Violation
    1Unmatched 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
    2Unmatched 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
    3Unmatched 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