Talk on Using Fuzzy Code Search to Link Code Fragments in Discussions to Source Code, given at the 16th European Conference on Software Maintenance and Reengineering (CSMR'12) in Hungary.
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source Code
1. Using Fuzzy Code Search to Link
Code Fragments in Discussions to
Source Code
Nicolas Bettenburg Stephen W. Thomas Ahmed E. Hassan
Queen’s University
Software Analysis and Intelligence Lab (SAIL)
Kingston, Ontario, Canada
2. “Given enough eyeballs,
all bugs are shallow.”
Eric S. Raymond - The Cathedral and the Bazaar
2
3. Objective in this Study:
Which parts of the
source code did
developers
discuss?
3
4. Objective in this Study:
Which parts of the
source code did
developers
discuss?
Finding Associations of Discussions with Source Code Files
3
7. Untitled 12-03-15 2:55 PM
Untitled 12-03-15 2:55 PM
this.opt_withObsolete = opt_withObsolete;
Untitled
} 12-03-15 2:55 PM
/* (non-Javadoc)
this.opt_withObsolete = opt_withObsolete;
* @see main.IExperiment#getDescription()
Untitled 12-03-15 2:55 PM
}
*/
public String getDescription() {
/* (non-Javadoc)
String description = "We want to run an experiment all those bug
this.opt_withObsolete = opt_withObsolete;
* @see main.IExperiment#getDescription()
reports.nt"
}
*/
+ "We extract the complete stacktrace information to study fix
public String getDescription() {
location and stacktrace interplay.nt";
/* (non-Javadoc)
String description = "We want to run an experiment all those bug
this.opt_withObsolete = opt_withObsolete;
return description;
* @see main.IExperiment#getDescription()
reports.nt"
}
} */
+ "We extract the complete stacktrace information to study fix
public String getDescription() {
location and stacktrace interplay.nt";
/* (non-Javadoc)
/* (non-Javadoc) String description = "We want to run an experiment all those bug
return description;
* @see main.IExperiment#getDescription()
* @see main.IExperiment#run()
reports.nt"
} */
*/ + "We extract the complete stacktrace information to study fix
public String getDescription() {
public boolean run() { location and stacktrace interplay.nt";
/* (non-Javadoc) String description = "We want to run an experiment all those bug
final boolean return = Main.isCli_withDebugMessages();
DEBUG description;
* @see main.IExperiment#run()reports.nt"
}
*/ + "We extract the complete stacktrace information to study fix
// Select an appropriate database name on the server depending on the
public boolean run() { location and stacktrace interplay.nt";
project demanded via command line options
/* (non-Javadoc)
final boolean return = Main.isCli_withDebugMessages();
DEBUG description;
String dbName = "";
* @see main.IExperiment#run()
}
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
*/
// Select an appropriate database name on the server depending on the
dbName = "eclipse-december-2007";
public boolean run() {
project demanded via command line options
/* (non-Javadoc)
else { final boolean DEBUG = Main.isCli_withDebugMessages();
String dbName = "";
* @see main.IExperiment#run()
System.out.println("We currently only support the Eclipse database
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
*/
!"); // Select an appropriate database name on the server depending on the
dbName = "eclipse-december-2007";
public boolean run() {
System.exit(0); project demanded via command line options
else { final boolean DEBUG = Main.isCli_withDebugMessages();
} String dbName = "";
System.out.println("We currently only support the Eclipse database
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
!"); // Select an appropriate database name on the server depending on the
dbName = "eclipse-december-2007";
System.exit(0); project demanded via command line options
// Create the else {Database Connection
} String dbName = "";
DatabaseConnector System.out.println("We currently only support the Eclipse database
dbc = new DatabaseConnector(Main.getCli_dbHost(),
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
!");
dbName = "eclipse-december-2007";
dbc.initialize(); System.exit(0);
// Create the else { Database Connection
if (!dbc.connect()) {
}
DatabaseConnector System.out.println("We currently only support the Eclipse database
dbc = new DatabaseConnector(Main.getCli_dbHost(),
System.out.println("Could not connect to database. Check host, port
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
!");
, username and password.");
dbc.initialize(); System.exit(0);
System.exit(1);
// Create the Database Connection
if (!dbc.connect()) {
}
} DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
System.out.println("Could not connect to database. Check host, port
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
, username and password.");
// Fetch a number of Bug Report unique IDs belonging to the following
dbc.initialize();
System.exit(1);
// Create the Database Connection
query if (!dbc.connect()) {
} DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
String setSelectionQuery = "SELECT DISTINCT not connect to database. Check host, port
System.out.println("Could bug_id FROM bugzilla_bugs
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
, username and password.");
// Fetch a number of Bug Report unique IDs belonging to the following
dbc.initialize();
LIMIT " + Main.getCli_amount();
System.exit(1);
query if (!dbc.connect()) {
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
}
String setSelectionQuery = "SELECT DISTINCT not connect to database. Check host, port
System.out.println("Could bug_id FROM bugzilla_bugs
int lastID = bugIDs[bugIDs.length -1];
WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
, username and password.");
// Fetch a number of Bug Report unique IDs belonging to the following
LIMIT " + Main.getCli_amount();
System.exit(1);
if (DEBUG) query
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
}
System.out.println("* Attempting to fetch " + bugIDs.length + " bugzilla_bugs
String setSelectionQuery = "SELECT DISTINCT bug_id FROM
int lastID = bugIDs[bugIDs.length -1];
reports from " + Main.getCli_dbHost() + " starting +with ID " BY bug_id ASC
WHERE bug_id > " + Main.getCli_startID() " ORDER +
// Fetch a number of Bug Report unique IDs belonging to the following
Main.getCli_startID());
LIMIT " + Main.getCli_amount();
if (DEBUG) query
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
System.out.println("* Attempting to fetch " + bugIDs.length + " bugzilla_bugs
String setSelectionQuery = "SELECT DISTINCT bug_id FROM
// Collect the bug reports bugIDs[bugIDs.length -1];up to 100 parallel
int lastID = from the database using
reports from " + Main.getCli_dbHost() + " starting +with ID " BY bug_id ASC
WHERE bug_id > " + Main.getCli_startID() " ORDER +
threads.
Main.getCli_startID());
LIMIT " + Main.getCli_amount();
if (DEBUG)
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
System.out.println("* Attempting to fetch " + bugIDs.length + "
// Collect the bug reports bugIDs[bugIDs.length -1];up to 100 parallel
int lastID = from the database using
reports from " + Main.getCli_dbHost() + " starting with ID " +
threads.
Main.getCli_startID());
if (DEBUG)
System.out.println("* Attempting to fetch " + bugIDs.length + "
// Collect the bug reports from the database using up to 100Page 2 of 4
parallel
reports from " + Main.getCli_dbHost() + " starting with ID " +
threads.
Main.getCli_startID());
// Collect the bug reports from the database using up to 100Page 2 of 4
parallel
threads.
Page 2 of 4
Page 2 of 4
Communication Source Code
Repository Archive
4
8. Untitled 12-03-15 2:55 PM
Untitled 12-03-15 2:55 PM
this.opt_withObsolete = opt_withObsolete;
Untitled
} 12-03-15 2:55 PM
/* (non-Javadoc)
this.opt_withObsolete = opt_withObsolete;
* @see main.IExperiment#getDescription()
Untitled 12-03-15 2:55 PM
}
*/
public String getDescription() {
/* (non-Javadoc)
String description = "We want to run an experiment all those bug
this.opt_withObsolete = opt_withObsolete;
* @see main.IExperiment#getDescription()
reports.nt"
}
*/
+ "We extract the complete stacktrace information to study fix
public String getDescription() {
location and stacktrace interplay.nt";
/* (non-Javadoc)
String description = "We want to run an experiment all those bug
this.opt_withObsolete = opt_withObsolete;
return description;
* @see main.IExperiment#getDescription()
reports.nt"
}
} */
+ "We extract the complete stacktrace information to study fix
public String getDescription() {
location and stacktrace interplay.nt";
/* (non-Javadoc)
/* (non-Javadoc) String description = "We want to run an experiment all those bug
return description;
* @see main.IExperiment#getDescription()
* @see main.IExperiment#run()
reports.nt"
} */
*/ + "We extract the complete stacktrace information to study fix
public String getDescription() {
public boolean run() { location and stacktrace interplay.nt";
/* (non-Javadoc) String description = "We want to run an experiment all those bug
final boolean return = Main.isCli_withDebugMessages();
DEBUG description;
* @see main.IExperiment#run()reports.nt"
}
*/ + "We extract the complete stacktrace information to study fix
// Select an appropriate database name on the server depending on the
public boolean run() { location and stacktrace interplay.nt";
project demanded via command line options
/* (non-Javadoc)
Traceability
final boolean return = Main.isCli_withDebugMessages();
DEBUG description;
String dbName = "";
* @see main.IExperiment#run()
}
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
*/
// Select an appropriate database name on the server depending on the
dbName = "eclipse-december-2007";
public boolean run() {
project demanded via command line options
/* (non-Javadoc)
else { final boolean DEBUG = Main.isCli_withDebugMessages();
String dbName = "";
* @see main.IExperiment#run()
System.out.println("We currently only support the Eclipse database
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
*/
!"); // Select an appropriate database name on the server depending on the
dbName = "eclipse-december-2007";
public boolean run() {
System.exit(0); project demanded via command line options
else { final boolean DEBUG = Main.isCli_withDebugMessages();
} String dbName = "";
System.out.println("We currently only support the Eclipse database
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
!"); // Select an appropriate database name on the server depending on the
dbName = "eclipse-december-2007";
System.exit(0); project demanded via command line options
// Create the else {Database Connection
} String dbName = "";
DatabaseConnector System.out.println("We currently only support the Eclipse database
dbc = new DatabaseConnector(Main.getCli_dbHost(),
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
!");
dbName = "eclipse-december-2007";
dbc.initialize(); System.exit(0);
// Create the else { Database Connection
if (!dbc.connect()) {
}
DatabaseConnector System.out.println("We currently only support the Eclipse database
dbc = new DatabaseConnector(Main.getCli_dbHost(),
System.out.println("Could not connect to database. Check host, port
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
!");
, username and password.");
dbc.initialize(); System.exit(0);
Links
System.exit(1);
// Create the Database Connection
if (!dbc.connect()) {
}
} DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
System.out.println("Could not connect to database. Check host, port
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
, username and password.");
// Fetch a number of Bug Report unique IDs belonging to the following
dbc.initialize();
System.exit(1);
// Create the Database Connection
query if (!dbc.connect()) {
} DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
String setSelectionQuery = "SELECT DISTINCT not connect to database. Check host, port
System.out.println("Could bug_id FROM bugzilla_bugs
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
, username and password.");
// Fetch a number of Bug Report unique IDs belonging to the following
dbc.initialize();
LIMIT " + Main.getCli_amount();
System.exit(1);
query if (!dbc.connect()) {
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
}
String setSelectionQuery = "SELECT DISTINCT not connect to database. Check host, port
System.out.println("Could bug_id FROM bugzilla_bugs
int lastID = bugIDs[bugIDs.length -1];
WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
, username and password.");
// Fetch a number of Bug Report unique IDs belonging to the following
LIMIT " + Main.getCli_amount();
System.exit(1);
if (DEBUG) query
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
}
System.out.println("* Attempting to fetch " + bugIDs.length + " bugzilla_bugs
String setSelectionQuery = "SELECT DISTINCT bug_id FROM
int lastID = bugIDs[bugIDs.length -1];
reports from " + Main.getCli_dbHost() + " starting +with ID " BY bug_id ASC
WHERE bug_id > " + Main.getCli_startID() " ORDER +
// Fetch a number of Bug Report unique IDs belonging to the following
Main.getCli_startID());
LIMIT " + Main.getCli_amount();
if (DEBUG) query
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
System.out.println("* Attempting to fetch " + bugIDs.length + " bugzilla_bugs
String setSelectionQuery = "SELECT DISTINCT bug_id FROM
// Collect the bug reports bugIDs[bugIDs.length -1];up to 100 parallel
int lastID = from the database using
reports from " + Main.getCli_dbHost() + " starting +with ID " BY bug_id ASC
WHERE bug_id > " + Main.getCli_startID() " ORDER +
threads.
Main.getCli_startID());
LIMIT " + Main.getCli_amount();
if (DEBUG)
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
System.out.println("* Attempting to fetch " + bugIDs.length + "
// Collect the bug reports bugIDs[bugIDs.length -1];up to 100 parallel
int lastID = from the database using
reports from " + Main.getCli_dbHost() + " starting with ID " +
threads.
Main.getCli_startID());
if (DEBUG)
System.out.println("* Attempting to fetch " + bugIDs.length + "
// Collect the bug reports from the database using up to 100Page 2 of 4
parallel
reports from " + Main.getCli_dbHost() + " starting with ID " +
threads.
Main.getCli_startID());
// Collect the bug reports from the database using up to 100Page 2 of 4
parallel
threads.
Page 2 of 4
Page 2 of 4
Communication Source Code
Repository Archive
4
12. 3 Approaches in the Past
Change Log Analysis
Information Retrieval
Lightweight Textual Analysis
6
13. Change Log Analysis
Untitled 12-03-15 2:55 PM
this.opt_withObsolete = opt_withObsolete;
}
/* (non-Javadoc)
* @see main.IExperiment#getDescription()
*/
public String getDescription() {
String description = "We want to run an experiment all those bug
reports.nt"
+ "We extract the complete stacktrace information to study fix
location and stacktrace interplay.nt";
return description;
}
/* (non-Javadoc)
* @see main.IExperiment#run()
LUCENE-2297: allow reader
*/
public boolean run() {
final boolean DEBUG = Main.isCli_withDebugMessages();
// Select an appropriate database name on the server depending on the
Untitled 12-03-15 2:55project demanded via command line options
PM
String dbName = "";
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
dbName = "eclipse-december-2007";
else {
System.out.println("We currently only support the Eclipse database
!");
this.opt_withObsolete = opt_withObsolete; System.exit(0);
} }
/* (non-Javadoc)
* @see main.IExperiment#getDescription() // Create the Database Connection
*/ DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
public String getDescription() { Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
String description = "We want to run an experiment all those bug dbc.initialize();
reports.nt" if (!dbc.connect()) {
pooling to be enabled (through
+ "We extract the complete stacktrace information to study fix System.out.println("Could not connect to database. Check host, port
location and stacktrace interplay.nt"; , username and password.");
return description; System.exit(1);
} }
/* (non-Javadoc) // Fetch a number of Bug Report unique IDs belonging to the following
* @see main.IExperiment#run() query
*/ String setSelectionQuery = "SELECT DISTINCT bug_id FROM bugzilla_bugs
public boolean run() { WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
final boolean DEBUG = Main.isCli_withDebugMessages(); LIMIT " + Main.getCli_amount();
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
// Select an appropriate database name on the server depending on the int lastID = bugIDs[bugIDs.length -1];
project demanded via command line options
String dbName = ""; if (DEBUG)
if (Main.getCli_project().equalsIgnoreCase("eclipse")) System.out.println("* Attempting to fetch " + bugIDs.length + "
dbName = "eclipse-december-2007"; reports from " + Main.getCli_dbHost() + " starting with ID " +
else { Main.getCli_startID());
System.out.println("We currently only support the Eclipse database
!"); // Collect the bug reports from the database using up to 100 parallel
System.exit(0); threads.
}
IndexWriterConfig) even if
Untitled // Create the DatabasePM
12-03-15 2:55 Connection
Untitled
DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(), 12-03-15 2:55 PM
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
dbc.initialize(); Page 2 of 4
if (!dbc.connect()) {
System.out.println("Could not connect to database. Check host, port
this.opt_withObsolete = opt_withObsolete; , username and password.");
} System.exit(1); this.opt_withObsolete = opt_withObsolete;
} }
/* (non-Javadoc)
* @see main.IExperiment#getDescription() // Fetch a number of Bug Report unique IDs belonging to the following
/* (non-Javadoc)
*/ query * @see main.IExperiment#getDescription()
public String getDescription() { String setSelectionQuery = "SELECT DISTINCT bug_id FROM */bugzilla_bugs
WHERE bug_id > " + Main.getCli_startID() + " ORDER public String getDescription() {
String description = "We want to run an experiment all those bug BY bug_id ASC
reports.nt" LIMIT " + Main.getCli_amount(); String description = "We want to run an experiment all those bug
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
+ "We extract the complete stacktrace information to study fix reports.nt"
location and stacktrace interplay.nt"; int lastID = bugIDs[bugIDs.length -1]; + "We extract the complete stacktrace information to study fix
return description; location and stacktrace interplay.nt";
if (DEBUG)
you're not pulling NRT reader.
} return description;
System.out.println("* Attempting to fetch " + bugIDs.length + "
}
/* (non-Javadoc) reports from " + Main.getCli_dbHost() + " starting with ID " +
* @see main.IExperiment#run() Main.getCli_startID()); /* (non-Javadoc)
*/ * @see main.IExperiment#run()
public boolean run() { // Collect the bug reports from the database using up to 100 parallel
*/
final boolean DEBUG = Main.isCli_withDebugMessages(); threads. public boolean run() {
final boolean DEBUG = Main.isCli_withDebugMessages();
// Select an appropriate database name on the server depending on the
project demanded via command line options // Select an appropriate database name on the server depending on the
String dbName = ""; project demanded via command line options
if (Main.getCli_project().equalsIgnoreCase("eclipse")) String dbName = "";
dbName = "eclipse-december-2007"; if (Main.getCli_project().equalsIgnoreCase("eclipse"))
Page 2 of 4
else { dbName = "eclipse-december-2007";
System.out.println("We currently only support the Eclipse database else {
!"); System.out.println("We currently only support the Eclipse database
System.exit(0); !");
} System.exit(0);
}
// Create the Database Connection
DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(), // Create the Database Connection
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName); DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
dbc.initialize(); Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
if (!dbc.connect()) { dbc.initialize();
System.out.println("Could not connect to database. Check host, port if (!dbc.connect()) {
, username and password."); System.out.println("Could not connect to database. Check host, port
System.exit(1); , username and password.");
} System.exit(1);
}
// Fetch a number of Bug Report unique IDs belonging to the following
query // Fetch a number of Bug Report unique IDs belonging to the following
String setSelectionQuery = "SELECT DISTINCT bug_id FROM bugzilla_bugs query
WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC String setSelectionQuery = "SELECT DISTINCT bug_id FROM bugzilla_bugs
LIMIT " + Main.getCli_amount(); WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery); LIMIT " + Main.getCli_amount();
int lastID = bugIDs[bugIDs.length -1]; int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
int lastID = bugIDs[bugIDs.length -1];
if (DEBUG)
System.out.println("* Attempting to fetch " + bugIDs.length + " if (DEBUG)
reports from " + Main.getCli_dbHost() + " starting with ID " + System.out.println("* Attempting to fetch " + bugIDs.length + "
Main.getCli_startID()); reports from " + Main.getCli_dbHost() + " starting with ID " +
Main.getCli_startID());
// Collect the bug reports from the database using up to 100 parallel
threads. // Collect the bug reports from the database using up to 100 parallel
threads.
SVN
Page 2 of 4
Page 2 of 4
7
14. Change Log Analysis
Untitled 12-03-15 2:55 PM
this.opt_withObsolete = opt_withObsolete;
}
/* (non-Javadoc)
* @see main.IExperiment#getDescription()
*/
public String getDescription() {
String description = "We want to run an experiment all those bug
reports.nt"
+ "We extract the complete stacktrace information to study fix
location and stacktrace interplay.nt";
return description;
}
/* (non-Javadoc)
* @see main.IExperiment#run()
LUCENE-2297: allow reader
*/
public boolean run() {
final boolean DEBUG = Main.isCli_withDebugMessages();
// Select an appropriate database name on the server depending on the
Untitled 12-03-15 2:55project demanded via command line options
PM
String dbName = "";
if (Main.getCli_project().equalsIgnoreCase("eclipse"))
dbName = "eclipse-december-2007";
else {
System.out.println("We currently only support the Eclipse database
!");
this.opt_withObsolete = opt_withObsolete; System.exit(0);
} }
/* (non-Javadoc)
* @see main.IExperiment#getDescription() // Create the Database Connection
*/ DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
public String getDescription() { Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
String description = "We want to run an experiment all those bug dbc.initialize();
reports.nt" if (!dbc.connect()) {
pooling to be enabled (through
+ "We extract the complete stacktrace information to study fix System.out.println("Could not connect to database. Check host, port
location and stacktrace interplay.nt"; , username and password.");
return description; System.exit(1);
} }
/* (non-Javadoc) // Fetch a number of Bug Report unique IDs belonging to the following
* @see main.IExperiment#run() query
*/ String setSelectionQuery = "SELECT DISTINCT bug_id FROM bugzilla_bugs
public boolean run() { WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
final boolean DEBUG = Main.isCli_withDebugMessages(); LIMIT " + Main.getCli_amount();
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
// Select an appropriate database name on the server depending on the int lastID = bugIDs[bugIDs.length -1];
project demanded via command line options
String dbName = ""; if (DEBUG)
if (Main.getCli_project().equalsIgnoreCase("eclipse")) System.out.println("* Attempting to fetch " + bugIDs.length + "
dbName = "eclipse-december-2007"; reports from " + Main.getCli_dbHost() + " starting with ID " +
else { Main.getCli_startID());
System.out.println("We currently only support the Eclipse database
!"); // Collect the bug reports from the database using up to 100 parallel
System.exit(0); threads.
}
IndexWriterConfig) even if
Untitled // Create the DatabasePM
12-03-15 2:55 Connection
Untitled
DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(), 12-03-15 2:55 PM
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
dbc.initialize(); Page 2 of 4
if (!dbc.connect()) {
System.out.println("Could not connect to database. Check host, port
this.opt_withObsolete = opt_withObsolete; , username and password.");
} System.exit(1); this.opt_withObsolete = opt_withObsolete;
} }
/* (non-Javadoc)
* @see main.IExperiment#getDescription() // Fetch a number of Bug Report unique IDs belonging to the following
/* (non-Javadoc)
*/ query * @see main.IExperiment#getDescription()
public String getDescription() { String setSelectionQuery = "SELECT DISTINCT bug_id FROM */bugzilla_bugs
WHERE bug_id > " + Main.getCli_startID() + " ORDER public String getDescription() {
String description = "We want to run an experiment all those bug BY bug_id ASC
reports.nt" LIMIT " + Main.getCli_amount(); String description = "We want to run an experiment all those bug
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
+ "We extract the complete stacktrace information to study fix reports.nt"
location and stacktrace interplay.nt"; int lastID = bugIDs[bugIDs.length -1]; + "We extract the complete stacktrace information to study fix
return description; location and stacktrace interplay.nt";
if (DEBUG)
you're not pulling NRT reader.
} return description;
System.out.println("* Attempting to fetch " + bugIDs.length + "
}
/* (non-Javadoc) reports from " + Main.getCli_dbHost() + " starting with ID " +
* @see main.IExperiment#run() Main.getCli_startID()); /* (non-Javadoc)
*/ * @see main.IExperiment#run()
public boolean run() { // Collect the bug reports from the database using up to 100 parallel
*/
final boolean DEBUG = Main.isCli_withDebugMessages(); threads. public boolean run() {
final boolean DEBUG = Main.isCli_withDebugMessages();
// Select an appropriate database name on the server depending on the
project demanded via command line options // Select an appropriate database name on the server depending on the
String dbName = ""; project demanded via command line options
if (Main.getCli_project().equalsIgnoreCase("eclipse")) String dbName = "";
dbName = "eclipse-december-2007"; if (Main.getCli_project().equalsIgnoreCase("eclipse"))
Page 2 of 4
else { dbName = "eclipse-december-2007";
System.out.println("We currently only support the Eclipse database else {
!"); System.out.println("We currently only support the Eclipse database
System.exit(0); !");
} System.exit(0);
}
// Create the Database Connection
DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(), // Create the Database Connection
Main.getCli_dbUser(), Main.getCli_dbPass(), dbName); DatabaseConnector dbc = new DatabaseConnector(Main.getCli_dbHost(),
dbc.initialize(); Main.getCli_dbUser(), Main.getCli_dbPass(), dbName);
if (!dbc.connect()) { dbc.initialize();
System.out.println("Could not connect to database. Check host, port if (!dbc.connect()) {
, username and password."); System.out.println("Could not connect to database. Check host, port
System.exit(1); , username and password.");
} System.exit(1);
}
// Fetch a number of Bug Report unique IDs belonging to the following
query // Fetch a number of Bug Report unique IDs belonging to the following
String setSelectionQuery = "SELECT DISTINCT bug_id FROM bugzilla_bugs query
WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC String setSelectionQuery = "SELECT DISTINCT bug_id FROM bugzilla_bugs
LIMIT " + Main.getCli_amount(); WHERE bug_id > " + Main.getCli_startID() + " ORDER BY bug_id ASC
int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery); LIMIT " + Main.getCli_amount();
int lastID = bugIDs[bugIDs.length -1]; int[] bugIDs = dbc.getIdSetByQuery(setSelectionQuery);
int lastID = bugIDs[bugIDs.length -1];
if (DEBUG)
System.out.println("* Attempting to fetch " + bugIDs.length + " if (DEBUG)
reports from " + Main.getCli_dbHost() + " starting with ID " + System.out.println("* Attempting to fetch " + bugIDs.length + "
Main.getCli_startID()); reports from " + Main.getCli_dbHost() + " starting with ID " +
Main.getCli_startID());
// Collect the bug reports from the database using up to 100 parallel
threads. // Collect the bug reports from the database using up to 100 parallel
threads.
SVN
Page 2 of 4
Page 2 of 4
7