Failure-Preventing
Recommendations


               Adrian
             Schröter
The Problem
Why is it a Problem?

       The US economy lost in 2002
         60 billion dollar
        due to software defects




  ...
What has been
done, so far ...
package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes;


import java.io.InputStream;

import java.util.Ha...
package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes;


                                                ...
package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes;


                                                ...
package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes;


                                                ...
package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes;


                                                ...
package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes;


                                                ...
package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes;


                                                ...
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Candidacy
Upcoming SlideShare
Loading in …5
×

Candidacy

395 views
346 views

Published on

This are the original slides that I used during my candidacy, I need to modify them for the ICSE doctoral symposium 2010, any feed back is as always more than welcome.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
395
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Candidacy

  1. 1. Failure-Preventing Recommendations Adrian Schröter
  2. 2. The Problem
  3. 3. Why is it a Problem? The US economy lost in 2002 60 billion dollar due to software defects http://www.nist.gov/public_affairs/releases/n02-10.htm
  4. 4. What has been done, so far ...
  5. 5. package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes; import java.io.InputStream; import java.util.HashMap; import ca.uvic.segal.jazz.extraction.datastructures.Instances; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.repository.common.IContent; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.scm.common.IChange; import com.ibm.team.scm.common.IFolder; import com.ibm.team.scm.common.IFolderHandle; import com.ibm.team.scm.common.IVersionableHandle; public class SimpleChange { private String kind = null; private String changeSetId = null; //private InputStream beforeFile = null; private IFileItemHandle beforeFile = null; private String beforeName = null; private String beforeFolder = null; //private InputStream afterFile = null; private IFileItemHandle afterFile = null; private String afterName = null; private String afterFolder = null; //private String filename = null; //private String folder = null; private boolean isFile = true; private HashMap<Integer,String> kindMap = new HashMap<Integer,String>(); private Instances instances = null; public SimpleChange(IChange change, String changeSetId, Instances instances) throws TeamRepositoryException { this.instances = instances; this.kindMap.put(new Integer(IChange.ADD), "ADD"); this.kindMap.put(new Integer(IChange.DELETE), "DELETE"); this.kindMap.put(new Integer(IChange.MODIFY), "MODIFY"); this.kindMap.put(new Integer(IChange.NONE), "NONE"); this.kindMap.put(new Integer(IChange.RENAME), "RENAME"); this.kindMap.put(new Integer(IChange.REPARENT), "REPARENT"); if (change.item().getItemType().equals(IFileItem.ITEM_TYPE)) { //this.beforeFile = this.getFile(change.beforeState(), instances); this.beforeFile = (IFileItemHandle) change.beforeState(); this.beforeFolder = this.extractFolder((IFileItemHandle) change.beforeState(), instances); this.beforeName = this.extractFileName((IFileItemHandle) change.beforeState(), instances); //this.afterFile = this.getFile(change.afterState(), instances); this.afterFile = (IFileItemHandle) change.afterState(); this.afterFolder = this.extractFolder((IFileItemHandle) change.afterState(), instances); this.afterName = this.extractFileName((IFileItemHandle) change.afterState(), instances); //this.filename = this.extractFileName((IFileItemHandle) change.item(), instances); //this.folder = this.extractFolder((IFileItemHandle) change.item(), instances); this.isFile = true; } if (change.item().getItemType().equals(IFolder.ITEM_TYPE)) { this.beforeFolder = this.extractFolder((IFolderHandle) change.beforeState(), instances); this.afterFolder = this.extractFolder((IFolderHandle) change.afterState(), instances); //this.folder = this.extractFolder((IFolderHandle) change.item(), instances); this.isFile = false; } this.changeSetId = changeSetId; this.kind = this.kindMap.get(change.kind()); } public String extractFileName(IFileItemHandle fileHandle, Instances instances) throws TeamRepositoryException { if (fileHandle != null && fileHandle.getStateId() != null) { IFileItem fileItem = (IFileItem) instances.workspaceManager.versionableManager().fetchCompleteState( fileHandle, instances.iProgressMonitor); return fileItem.getName(); } return null; } public String extractFolder(IFolderHandle _folderHandle, Instances instances) throws TeamRepositoryException { if (_folderHandle != null) { IFolderHandle folderHandle = _folderHandle; String folderName = ""; while (folderHandle != null && folderHandle.getStateId() != null) { IFolder folder = (IFolder) instances.workspaceManager.versionableManager().fetchCompleteState( folderHandle, instances.iProgressMonitor); folderName = folder.getName() + "/" + folderName; folderHandle = folder.getParent(); } return folderName.equals("") ? null : folderName; } return null; A.java
  6. 6. package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes; import java.io.InputStream; import java.util.HashMap; import ca.uvic.segal.jazz.extraction.datastructures.Instances; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.repository.common.IContent; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.scm.common.IChange; import com.ibm.team.scm.common.IFolder; import com.ibm.team.scm.common.IFolderHandle; import com.ibm.team.scm.common.IVersionableHandle; public class SimpleChange { private String kind = null; private String changeSetId = null; //private InputStream beforeFile = null; private IFileItemHandle beforeFile = null; private String beforeName = null; private String beforeFolder = null; //private InputStream afterFile = null; private IFileItemHandle afterFile = null; private String afterName = null; private String afterFolder = null; //private String filename = null; //private String folder = null; size private boolean isFile = true; private HashMap<Integer,String> kindMap = new HashMap<Integer,String>(); private Instances instances = null; public SimpleChange(IChange change, String changeSetId, Instances instances) throws TeamRepositoryException { this.instances = instances; this.kindMap.put(new Integer(IChange.ADD), "ADD"); this.kindMap.put(new Integer(IChange.DELETE), "DELETE"); this.kindMap.put(new Integer(IChange.MODIFY), "MODIFY"); this.kindMap.put(new Integer(IChange.NONE), "NONE"); this.kindMap.put(new Integer(IChange.RENAME), "RENAME"); this.kindMap.put(new Integer(IChange.REPARENT), "REPARENT"); if (change.item().getItemType().equals(IFileItem.ITEM_TYPE)) { //this.beforeFile = this.getFile(change.beforeState(), instances); this.beforeFile = (IFileItemHandle) change.beforeState(); this.beforeFolder = this.extractFolder((IFileItemHandle) change.beforeState(), instances); this.beforeName = this.extractFileName((IFileItemHandle) change.beforeState(), instances); //this.afterFile = this.getFile(change.afterState(), instances); this.afterFile = (IFileItemHandle) change.afterState(); this.afterFolder = this.extractFolder((IFileItemHandle) change.afterState(), instances); this.afterName = this.extractFileName((IFileItemHandle) change.afterState(), instances); //this.filename = this.extractFileName((IFileItemHandle) change.item(), instances); //this.folder = this.extractFolder((IFileItemHandle) change.item(), instances); this.isFile = true; } if (change.item().getItemType().equals(IFolder.ITEM_TYPE)) { this.beforeFolder = this.extractFolder((IFolderHandle) change.beforeState(), instances); this.afterFolder = this.extractFolder((IFolderHandle) change.afterState(), instances); //this.folder = this.extractFolder((IFolderHandle) change.item(), instances); this.isFile = false; } this.changeSetId = changeSetId; this.kind = this.kindMap.get(change.kind()); } public String extractFileName(IFileItemHandle fileHandle, Instances instances) throws TeamRepositoryException { if (fileHandle != null && fileHandle.getStateId() != null) { IFileItem fileItem = (IFileItem) instances.workspaceManager.versionableManager().fetchCompleteState( fileHandle, instances.iProgressMonitor); return fileItem.getName(); } return null; } public String extractFolder(IFolderHandle _folderHandle, Instances instances) throws TeamRepositoryException { if (_folderHandle != null) { IFolderHandle folderHandle = _folderHandle; String folderName = ""; while (folderHandle != null && folderHandle.getStateId() != null) { IFolder folder = (IFolder) instances.workspaceManager.versionableManager().fetchCompleteState( folderHandle, instances.iProgressMonitor); folderName = folder.getName() + "/" + folderName; folderHandle = folder.getParent(); } return folderName.equals("") ? null : folderName; } return null; A.java T. L. Graves, A. F. Karr, J. S. Marron, and H. P. Siy. Predicting fault incidence using software change history. IEEE Transactions on Software Engineering, 26(7):653–661, 2000.
  7. 7. package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes; import java.io.InputStream; import java.util.HashMap; import ca.uvic.segal.jazz.extraction.datastructures.Instances; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.repository.common.IContent; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.scm.common.IChange; import com.ibm.team.scm.common.IFolder; import com.ibm.team.scm.common.IFolderHandle; import com.ibm.team.scm.common.IVersionableHandle; public class SimpleChange { private String kind = null; private String changeSetId = null; //private InputStream beforeFile = null; private IFileItemHandle beforeFile = null; private String beforeName = null; private String beforeFolder = null; //private InputStream afterFile = null; private IFileItemHandle afterFile = null; private String afterName = null; private String afterFolder = null; //private String filename = null; //private String folder = null; size private boolean isFile = true; private HashMap<Integer,String> kindMap = new HashMap<Integer,String>(); private Instances instances = null; public SimpleChange(IChange change, String changeSetId, Instances instances) throws TeamRepositoryException { this.instances = instances; this.kindMap.put(new Integer(IChange.ADD), "ADD"); this.kindMap.put(new Integer(IChange.DELETE), "DELETE"); this.kindMap.put(new Integer(IChange.MODIFY), "MODIFY"); this.kindMap.put(new Integer(IChange.NONE), "NONE"); this.kindMap.put(new Integer(IChange.RENAME), "RENAME"); this.kindMap.put(new Integer(IChange.REPARENT), "REPARENT"); if (change.item().getItemType().equals(IFileItem.ITEM_TYPE)) { //this.beforeFile = this.getFile(change.beforeState(), instances); this.beforeFile = (IFileItemHandle) change.beforeState(); this.beforeFolder = this.extractFolder((IFileItemHandle) change.beforeState(), instances); this.beforeName = this.extractFileName((IFileItemHandle) change.beforeState(), instances); //this.afterFile = this.getFile(change.afterState(), instances); this.afterFile = (IFileItemHandle) change.afterState(); this.afterFolder = this.extractFolder((IFileItemHandle) change.afterState(), instances); this.afterName = this.extractFileName((IFileItemHandle) change.afterState(), instances); //this.filename = this.extractFileName((IFileItemHandle) change.item(), instances); //this.folder = this.extractFolder((IFileItemHandle) change.item(), instances); this.isFile = true; } if (change.item().getItemType().equals(IFolder.ITEM_TYPE)) { this.beforeFolder = this.extractFolder((IFolderHandle) change.beforeState(), instances); complexity this.afterFolder = this.extractFolder((IFolderHandle) change.afterState(), instances); //this.folder = this.extractFolder((IFolderHandle) change.item(), instances); this.isFile = false; } this.changeSetId = changeSetId; this.kind = this.kindMap.get(change.kind()); } public String extractFileName(IFileItemHandle fileHandle, Instances instances) throws TeamRepositoryException { if (fileHandle != null && fileHandle.getStateId() != null) { IFileItem fileItem = (IFileItem) instances.workspaceManager.versionableManager().fetchCompleteState( fileHandle, instances.iProgressMonitor); return fileItem.getName(); } return null; } public String extractFolder(IFolderHandle _folderHandle, Instances instances) throws TeamRepositoryException { if (_folderHandle != null) { IFolderHandle folderHandle = _folderHandle; String folderName = ""; while (folderHandle != null && folderHandle.getStateId() != null) { IFolder folder = (IFolder) instances.workspaceManager.versionableManager().fetchCompleteState( folderHandle, instances.iProgressMonitor); folderName = folder.getName() + "/" + folderName; folderHandle = folder.getParent(); } return folderName.equals("") ? null : folderName; } return null; A.java T. L. Graves, A. F. Karr, J. S. Marron, and H. P. Siy. Predicting fault incidence using software change history. IEEE Transactions on Software Engineering, 26(7):653–661, 2000.
  8. 8. package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes; import java.io.InputStream; import java.util.HashMap; import ca.uvic.segal.jazz.extraction.datastructures.Instances; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.repository.common.IContent; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.scm.common.IChange; import com.ibm.team.scm.common.IFolder; import com.ibm.team.scm.common.IFolderHandle; import com.ibm.team.scm.common.IVersionableHandle; public class SimpleChange { private String kind = null; private String changeSetId = null; //private InputStream beforeFile = null; private IFileItemHandle beforeFile = null; private String beforeName = null; private String beforeFolder = null; //private InputStream afterFile = null; private IFileItemHandle afterFile = null; private String afterName = null; private String afterFolder = null; //private String filename = null; //private String folder = null; size #developers private boolean isFile = true; private HashMap<Integer,String> kindMap = new HashMap<Integer,String>(); private Instances instances = null; public SimpleChange(IChange change, String changeSetId, Instances instances) throws TeamRepositoryException { this.instances = instances; this.kindMap.put(new Integer(IChange.ADD), "ADD"); this.kindMap.put(new Integer(IChange.DELETE), "DELETE"); this.kindMap.put(new Integer(IChange.MODIFY), "MODIFY"); this.kindMap.put(new Integer(IChange.NONE), "NONE"); this.kindMap.put(new Integer(IChange.RENAME), "RENAME"); this.kindMap.put(new Integer(IChange.REPARENT), "REPARENT"); if (change.item().getItemType().equals(IFileItem.ITEM_TYPE)) { //this.beforeFile = this.getFile(change.beforeState(), instances); this.beforeFile = (IFileItemHandle) change.beforeState(); this.beforeFolder = this.extractFolder((IFileItemHandle) change.beforeState(), instances); this.beforeName = this.extractFileName((IFileItemHandle) change.beforeState(), instances); //this.afterFile = this.getFile(change.afterState(), instances); this.afterFile = (IFileItemHandle) change.afterState(); this.afterFolder = this.extractFolder((IFileItemHandle) change.afterState(), instances); this.afterName = this.extractFileName((IFileItemHandle) change.afterState(), instances); //this.filename = this.extractFileName((IFileItemHandle) change.item(), instances); //this.folder = this.extractFolder((IFileItemHandle) change.item(), instances); this.isFile = true; } if (change.item().getItemType().equals(IFolder.ITEM_TYPE)) { this.beforeFolder = this.extractFolder((IFolderHandle) change.beforeState(), instances); complexity this.afterFolder = this.extractFolder((IFolderHandle) change.afterState(), instances); //this.folder = this.extractFolder((IFolderHandle) change.item(), instances); this.isFile = false; } this.changeSetId = changeSetId; this.kind = this.kindMap.get(change.kind()); } public String extractFileName(IFileItemHandle fileHandle, Instances instances) throws TeamRepositoryException { if (fileHandle != null && fileHandle.getStateId() != null) { IFileItem fileItem = (IFileItem) instances.workspaceManager.versionableManager().fetchCompleteState( fileHandle, instances.iProgressMonitor); return fileItem.getName(); } return null; } public String extractFolder(IFolderHandle _folderHandle, Instances instances) throws TeamRepositoryException { if (_folderHandle != null) { IFolderHandle folderHandle = _folderHandle; String folderName = ""; while (folderHandle != null && folderHandle.getStateId() != null) { IFolder folder = (IFolder) instances.workspaceManager.versionableManager().fetchCompleteState( folderHandle, instances.iProgressMonitor); folderName = folder.getName() + "/" + folderName; folderHandle = folder.getParent(); } return folderName.equals("") ? null : folderName; } return null; A.java E. Weyuker, T. Ostrand and R. Bell. Do too many cooks spoil the broth? Using the number of developers to enhance defect prediction models. In Journal Empirical Software Engineering, pages 539–559, 2008.
  9. 9. package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes; import java.io.InputStream; import java.util.HashMap; import ca.uvic.segal.jazz.extraction.datastructures.Instances; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.repository.common.IContent; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.scm.common.IChange; import com.ibm.team.scm.common.IFolder; import com.ibm.team.scm.common.IFolderHandle; import com.ibm.team.scm.common.IVersionableHandle; public class SimpleChange { private String kind = null; private String changeSetId = null; //private InputStream beforeFile = null; private IFileItemHandle beforeFile = null; private String beforeName = null; private String beforeFolder = null; //private InputStream afterFile = null; private IFileItemHandle afterFile = null; private String afterName = null; private String afterFolder = null; //private String filename = null; //private String folder = null; size #developers private boolean isFile = true; private HashMap<Integer,String> kindMap = new HashMap<Integer,String>(); private Instances instances = null; public SimpleChange(IChange change, String changeSetId, Instances instances) throws TeamRepositoryException { this.instances = instances; this.kindMap.put(new Integer(IChange.ADD), "ADD"); this.kindMap.put(new Integer(IChange.DELETE), "DELETE"); this.kindMap.put(new Integer(IChange.MODIFY), "MODIFY"); this.kindMap.put(new Integer(IChange.NONE), "NONE"); this.kindMap.put(new Integer(IChange.RENAME), "RENAME"); this.kindMap.put(new Integer(IChange.REPARENT), "REPARENT"); if (change.item().getItemType().equals(IFileItem.ITEM_TYPE)) { //this.beforeFile = this.getFile(change.beforeState(), instances); this.beforeFile = (IFileItemHandle) change.beforeState(); this.beforeFolder = this.extractFolder((IFileItemHandle) change.beforeState(), instances); this.beforeName = this.extractFileName((IFileItemHandle) change.beforeState(), instances); //this.afterFile = this.getFile(change.afterState(), instances); this.afterFile = (IFileItemHandle) change.afterState(); this.afterFolder = this.extractFolder((IFileItemHandle) change.afterState(), instances); this.afterName = this.extractFileName((IFileItemHandle) change.afterState(), instances); //this.filename = this.extractFileName((IFileItemHandle) change.item(), instances); //this.folder = this.extractFolder((IFileItemHandle) change.item(), instances); this.isFile = true; } if (change.item().getItemType().equals(IFolder.ITEM_TYPE)) { this.beforeFolder = this.extractFolder((IFolderHandle) change.beforeState(), instances); complexity #changes this.afterFolder = this.extractFolder((IFolderHandle) change.afterState(), instances); //this.folder = this.extractFolder((IFolderHandle) change.item(), instances); this.isFile = false; } this.changeSetId = changeSetId; this.kind = this.kindMap.get(change.kind()); } public String extractFileName(IFileItemHandle fileHandle, Instances instances) throws TeamRepositoryException { if (fileHandle != null && fileHandle.getStateId() != null) { IFileItem fileItem = (IFileItem) instances.workspaceManager.versionableManager().fetchCompleteState( fileHandle, instances.iProgressMonitor); return fileItem.getName(); } return null; } public String extractFolder(IFolderHandle _folderHandle, Instances instances) throws TeamRepositoryException { if (_folderHandle != null) { IFolderHandle folderHandle = _folderHandle; String folderName = ""; while (folderHandle != null && folderHandle.getStateId() != null) { IFolder folder = (IFolder) instances.workspaceManager.versionableManager().fetchCompleteState( folderHandle, instances.iProgressMonitor); folderName = folder.getName() + "/" + folderName; folderHandle = folder.getParent(); } return folderName.equals("") ? null : folderName; } return null; A.java N. Nagappan and T. Ball. Use of Relative Code Churn Measures to Predict System Defect Density. In Proceedings of the 27th International Conference on Software Engineering, pages 284–292, 2005.
  10. 10. package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes; import java.io.InputStream; import java.util.HashMap; import ca.uvic.segal.jazz.extraction.datastructures.Instances; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.repository.common.IContent; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.scm.common.IChange; import com.ibm.team.scm.common.IFolder; import com.ibm.team.scm.common.IFolderHandle; import com.ibm.team.scm.common.IVersionableHandle; public class SimpleChange { private String kind = null; private String changeSetId = null; //private InputStream beforeFile = null; private IFileItemHandle beforeFile = null; private String beforeName = null; private String beforeFolder = null; //private InputStream afterFile = null; private IFileItemHandle afterFile = null; private String afterName = null; private String afterFolder = null; //private String filename = null; //private String folder = null; dev + code #developers private boolean isFile = true; private HashMap<Integer,String> kindMap = new HashMap<Integer,String>(); private Instances instances = null; public SimpleChange(IChange change, String changeSetId, Instances instances) throws TeamRepositoryException { this.instances = instances; this.kindMap.put(new Integer(IChange.ADD), "ADD"); this.kindMap.put(new Integer(IChange.DELETE), "DELETE"); this.kindMap.put(new Integer(IChange.MODIFY), "MODIFY"); this.kindMap.put(new Integer(IChange.NONE), "NONE"); this.kindMap.put(new Integer(IChange.RENAME), "RENAME"); this.kindMap.put(new Integer(IChange.REPARENT), "REPARENT"); if (change.item().getItemType().equals(IFileItem.ITEM_TYPE)) { //this.beforeFile = this.getFile(change.beforeState(), instances); this.beforeFile = (IFileItemHandle) change.beforeState(); this.beforeFolder = this.extractFolder((IFileItemHandle) change.beforeState(), instances); this.beforeName = this.extractFileName((IFileItemHandle) change.beforeState(), instances); //this.afterFile = this.getFile(change.afterState(), instances); this.afterFile = (IFileItemHandle) change.afterState(); this.afterFolder = this.extractFolder((IFileItemHandle) change.afterState(), instances); this.afterName = this.extractFileName((IFileItemHandle) change.afterState(), instances); //this.filename = this.extractFileName((IFileItemHandle) change.item(), instances); //this.folder = this.extractFolder((IFileItemHandle) change.item(), instances); this.isFile = true; } if (change.item().getItemType().equals(IFolder.ITEM_TYPE)) { this.beforeFolder = this.extractFolder((IFolderHandle) change.beforeState(), instances); complexity #changes this.afterFolder = this.extractFolder((IFolderHandle) change.afterState(), instances); //this.folder = this.extractFolder((IFolderHandle) change.item(), instances); this.isFile = false; } this.changeSetId = changeSetId; this.kind = this.kindMap.get(change.kind()); } public String extractFileName(IFileItemHandle fileHandle, Instances instances) throws TeamRepositoryException { if (fileHandle != null && fileHandle.getStateId() != null) { IFileItem fileItem = (IFileItem) instances.workspaceManager.versionableManager().fetchCompleteState( fileHandle, instances.iProgressMonitor); return fileItem.getName(); } return null; } public String extractFolder(IFolderHandle _folderHandle, Instances instances) throws TeamRepositoryException { if (_folderHandle != null) { IFolderHandle folderHandle = _folderHandle; String folderName = ""; while (folderHandle != null && folderHandle.getStateId() != null) { IFolder folder = (IFolder) instances.workspaceManager.versionableManager().fetchCompleteState( folderHandle, instances.iProgressMonitor); folderName = folder.getName() + "/" + folderName; folderHandle = folder.getParent(); } return folderName.equals("") ? null : folderName; } return null; A.java C. Bird, N. Nagappan, H. Gall, B. Murphy and P. Devanbu. Putting It All Together: Using Socio-technical Networks to Predict Failures. In Proceedings of the 20th International Symposium on Software Reliability Engineering, pages 109–119, 2009.
  11. 11. package ca.uvic.segal.jazz.extraction.datastructures.artifacts.changes; import java.io.InputStream; import java.util.HashMap; import ca.uvic.segal.jazz.extraction.datastructures.Instances; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.repository.common.IContent; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.scm.common.IChange; import com.ibm.team.scm.common.IFolder; import com.ibm.team.scm.common.IFolderHandle; import com.ibm.team.scm.common.IVersionableHandle; public class SimpleChange { private String kind = null; private String changeSetId = null; //private InputStream beforeFile = null; private IFileItemHandle beforeFile = null; private String beforeName = null; private String beforeFolder = null; //private InputStream afterFile = null; private IFileItemHandle afterFile = null; private String afterName = null; private String afterFolder = null; //private String filename = null; //private String folder = null; dev + code #developers private boolean isFile = true; private HashMap<Integer,String> kindMap = new HashMap<Integer,String>(); private Instances instances = null; public SimpleChange(IChange change, String changeSetId, Instances instances) throws TeamRepositoryException { this.instances = instances; this.kindMap.put(new Integer(IChange.ADD), "ADD"); this.kindMap.put(new Integer(IChange.DELETE), "DELETE"); this.kindMap.put(new Integer(IChange.MODIFY), "MODIFY"); this.kindMap.put(new Integer(IChange.NONE), "NONE"); this.kindMap.put(new Integer(IChange.RENAME), "RENAME"); this.kindMap.put(new Integer(IChange.REPARENT), "REPARENT"); if (change.item().getItemType().equals(IFileItem.ITEM_TYPE)) { //this.beforeFile = this.getFile(change.beforeState(), instances); this.beforeFile = (IFileItemHandle) change.beforeState(); this.beforeFolder = this.extractFolder((IFileItemHandle) change.beforeState(), instances); this.beforeName = this.extractFileName((IFileItemHandle) change.beforeState(), instances); //this.afterFile = this.getFile(change.afterState(), instances); this.afterFile = (IFileItemHandle) change.afterState(); this.afterFolder = this.extractFolder((IFileItemHandle) change.afterState(), instances); this.afterName = this.extractFileName((IFileItemHandle) change.afterState(), instances); //this.filename = this.extractFileName((IFileItemHandle) change.item(), instances); //this.folder = this.extractFolder((IFileItemHandle) change.item(), instances); this.isFile = true; } if (change.item().getItemType().equals(IFolder.ITEM_TYPE)) { this.beforeFolder = this.extractFolder((IFolderHandle) change.beforeState(), instances); dependency #changes this.afterFolder = this.extractFolder((IFolderHandle) change.afterState(), instances); //this.folder = this.extractFolder((IFolderHandle) change.item(), instances); this.isFile = false; } this.changeSetId = changeSetId; this.kind = this.kindMap.get(change.kind()); } public String extractFileName(IFileItemHandle fileHandle, Instances instances) throws TeamRepositoryException { if (fileHandle != null && fileHandle.getStateId() != null) { IFileItem fileItem = (IFileItem) instances.workspaceManager.versionableManager().fetchCompleteState( fileHandle, instances.iProgressMonitor); return fileItem.getName(); } return null; } public String extractFolder(IFolderHandle _folderHandle, Instances instances) throws TeamRepositoryException { if (_folderHandle != null) { IFolderHandle folderHandle = _folderHandle; String folderName = ""; while (folderHandle != null && folderHandle.getStateId() != null) { IFolder folder = (IFolder) instances.workspaceManager.versionableManager().fetchCompleteState( folderHandle, instances.iProgressMonitor); folderName = folder.getName() + "/" + folderName; folderHandle = folder.getParent(); } return folderName.equals("") ? null : folderName; } return null; A.java T. Zimmermann and N. Nagappan. Predicting defects using network analysis on dependency graphs. In Proceedings of the 30th International Conference on Software Engineering, pages 531–540, 2008.

×