Automatic Identification of bug inducing changes

Post on 19-Jun-2015

182 views 3 download

Tags:

description

Presented in CMPUT664 , Wi '12 in UofAlberta

Transcript of Automatic Identification of bug inducing changes

Automatic Identification of Bug-

Introducing Changes

Kim, Zimmermann, Pan, Whitehead

Presented By**:

Arnamoy Bhattacharyya

University of Alberta

**some slides are taken from the presentation of Nicolas Bettenburg

Control Development

Multi User Access

Change History

Capture Problems

Multi User Access

Error History

Bug Report #5612 reports an error

Error fixed in version 0.13

Commit Message in 0.13 : "Fixed Bug #5612"

Finding changes that have repaired a bug

searching for keywords such as "Fixed" or "Bug"

searching for references to bug reports like “#42233”

when?

who?

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5: }

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: }

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

7. }

Revision 0.11 Revision 0.12 Revision 0.13

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5:

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: }

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

Revision 0.11 Revision 0.12 Revision 0.13

Running diff tool between 0.12 and 0.13

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5: }

6: }

0.12 sam 1: public void foo() {

0.11 kim 2: // print report

0.12 sam 3: if (report == null)

0.12 sam 4: {

0.11 kim 5: println(report);

0.11 kim 6: }

0.11 kim 7: }

public void foo() {

// print out report

3: if (report != null)

4: {

5: println(report);

6: }

7: }

Revision 0.11 Revision 0.12 Revision 0.13

$ cvs annotate –r 0.12 Foo.java

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5: }

6: }

0.12 sam 1: public void foo() {

0.11 kim 2: // print report

0.12 sam 3: if (report == null)

0.12 sam 4: {

0.11 kim 5: println(report);

0.11 kim 6: }

0.11 kim 7: }

public void foo() {

// print out report

3: if (report != null)

4: {

5: println(report);

6: }

7: }

Revision 0.11 Revision 0.12 Revision 0.13

Not

Necessary

Not

Necessary

Necessary

but WRONG

Use Annotation Graphs

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5:}

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: }

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

7. }

Revision 0.11 Revision 0.12 Revision 0.13

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5:

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: -----

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

Revision 0.11 Revision 0.12 Revision 0.13

Detect

function name

changesFind Bug Inducing

Change

False Positive - Indicated as Bug Inducing Change but actually not

False Negative- NOT Indicated as Bug Inducing Change but

actually is one

4.1. Using Annotation Graph

4.2. Non Behavior Changes

1. Comments2. Changes to source code format

3. Addition/removal of blank lines

1: public void bar() {

2: if (report == null) {

3: println(report);

4: }

1: public void bar() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6:

7: }

����Addition of comment

� Change of Source code format

� Addition of Blank Lines

Ignoring Blank Lines and Comments

removes 14%~20% of false positives

removes 18%~25% of false positives and 13%~14% of false

negatives.

Ignoring Source Code Format Changes

4.4. Remove Fix Revision Outliers

most of the changes are method name and parameter name changes

ignoring outlier revisions removes 7%~16% of false positives

possible that we are ignoring changes are real bug-fixes

4.5. Manual Fix Hunk Verification

how many bug-fix hunks are true bug-fixes???

Not perfect BUT Close Enough!!

Train Data

Help HATARI