Mining API error-handling specifications from source code

Mithun Acharya, Tao Xie

Research output: Chapter in Book/Report/Conference proceedingConference contribution


API error-handling specifications are often not documented, necessitating automated specification mining. Automated mining of error-handling specifications is challenging for procedural languages such as C, which lack explicit exception-handling mechanisms. Due to the lack of explicit exception handling, error-handling code is often scattered across different procedures and files making it difficult to mine error-handling specifications through manual inspection of source code. In this paper, we present a novel framework for mining API error-handling specifications automatically from API client code, without any user input. In our framework, we adapt a trace generation technique to distinguish and generate static traces representing different API run-time behaviors. We apply data mining techniques on the static traces to mine specifications that define correct handling of API errors. We then use the mined specifications to detect API error-handling violations. Our framework mines 62 error-handling specifications and detects 264 real error-handling defects from the analyzed open source packages.

Original languageEnglish (US)
Title of host publicationFundamental Approaches to Software Engineering - 12th International Conference, FASE 2009, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009, Proceedings.
Number of pages15
StatePublished - 2009
Externally publishedYes
Event12th International Conference on Fundamental Approaches to Software Engineering, FASE 2009 -
Duration: Mar 22 2009Mar 29 2009

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Other12th International Conference on Fundamental Approaches to Software Engineering, FASE 2009

ASJC Scopus subject areas

  • Theoretical Computer Science
  • General Computer Science


Dive into the research topics of 'Mining API error-handling specifications from source code'. Together they form a unique fingerprint.

Cite this