1 Exception Analysis for Java Byeong-Mo Chang Sookmyung Women’s Univ., Korea.

Slides:



Advertisements
Similar presentations
Exceptions Chapter Throwing and Catching Exceptions When a program runs into a problem that it cannot handle, it throws an exception. Exceptions.
Advertisements

C++ Programming Languages
Exceptions Ensuring program reliability. Program correctness The term program correctness refers to a program’s working as advertised; that is, it produces.
Exception Handling The purpose of exception handling is to permit the program to catch and handle errors rather than letting the error occur and suffer.
Exception Handling Chapter 15 2 What You Will Learn Use try, throw, catch to watch for indicate exceptions handle How to process exceptions and failures.
An Introduction to Java Programming and Object- Oriented Application Development Chapter 8 Exceptions and Assertions.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
CSC 212 – Data Structures Lecture 10: More Inheritance & Exceptions.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 13 In a language without exception handling: When an exception occurs, control goes to the operating.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Exception Handling. Introduction An exception is an abnormal condition that arises in a code sequence at run time. In computer languages that do not support.
1 Lecture 11 Interfaces and Exception Handling from Chapters 9 and 10.
Lecture 28 More on Exceptions COMP1681 / SE15 Introduction to Programming.
Exception Handling. Background The fact that software modules should be robust enough to work under every situation. The exception handling mechanism.
Slides prepared by Rose Williams, Binghamton University Chapter 9 Exception Handling.
Exceptions Three categories of errors: Syntax errors Runtime errors Logic errors Syntax errors: rules of the language have not been followed. Runtime error:
Transformation of Java Card into Diet Java Semester Project Presentation Erich Laube.
Chapter 11: Handling Exceptions and Events J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Fourth.
12.1 Exceptions The limitations of traditional methods of exception handling Error conditions are a certainty in programming Programmers make.
Exceptions. Many problems in code are handled when the code is compiled, but not all Some are impossible to catch before the program is run  Must run.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
1 Exception Handling Introduction to Exception Handling Exception Handling in PLs –Ada –C++ –Java Sebesta Chapter 14.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 9 : Exception Handling King Fahd University of Petroleum & Minerals College of Computer.
Chapter 12 Inheritance and Exceptions Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas,
May 21, ICE 1341 – Programming Languages (Lecture #21) In-Young Ko Programming Languages (ICE 1341) Lecture #21 Programming Languages (ICE 1341)
Object Oriented Programming
CIS 270—Application Development II Chapter 13—Exception Handling.
220 FINAL TEST REVIEW SESSION Omar Abdelwahab. INHERITANCE AND POLYMORPHISM Suppose you have a class FunClass with public methods show, tell, and smile.
P ARALLEL P ROCESSING I NSTITUTE · F UDAN U NIVERSITY 1.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
Exception Handling in JAVA. Introduction Exception is an abnormal condition that arises when executing a program. In the languages that do not support.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 10.
1 SystemVerilog Enhancement Requests Daniel Schostak Principal Engineer February 26 th 2010.
Exception Handling Unit-6. Introduction An exception is a problem that arises during the execution of a program. An exception can occur for many different.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Data Structures Using Java1 Chapter 2 Inheritance and Exception Handling.
Chapter 12 Handling Exceptions and Events. Chapter Objectives Learn what an exception is Become aware of the hierarchy of exception classes Learn about.
Computing Simulation in Orders Based Transparent Parallelizing Pavlenko Vitaliy Danilovich, Odessa National Polytechnic University Burdeinyi Viktor Viktorovych,
A Specification Logic for Exceptions and Beyond Cristina David Cristian Gherghina National University of Singapore.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
CS212: Object Oriented Analysis and Design Lecture 19: Exception Handling.
Exception-Handling Fundamentals  A Java exception is an object that describes an exceptional (that is, error) condition that has occurred in a piece of.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
Exception. Agenda Exception. Handling Exceptions. The finally Clause.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
ECE122 L23: Exceptions December 6, 2007 ECE 122 Engineering Problem Solving with Java Lecture 24 Exceptions.
Introduction to Exceptions in Java CS201, SW Development Methods.
Exception testing Aistis Karkauskas, IFM-2/2. Introduction  Exceptions – anomalous or exceptional events requiring special processing – often changing.
CSE 332: C++ Exceptions Motivation for C++ Exceptions Void Number:: operator/= (const double denom) { if (denom == 0.0) { // what to do here? } m_value.
More Security and Programming Language Work on SmartPhones
Jim Fawcett CSE687-OnLine – Object Oriented Design Summer 2017
Jim Fawcett CSE687 – Object Oriented Design Spring 2001
Jim Fawcett CSE687 – Object Oriented Design Spring 2015
Java Programming Language
Representation, Syntax, Paradigms, Types
Mutation testing Julius Purvinis IFM-0/2.
Exception Handling Chapter 9.
Java Programming Language
Exception Handling Chapter 9 Edited by JJ.
Representation, Syntax, Paradigms, Types
Representation, Syntax, Paradigms, Types
창 병 모 숙명여대 전산학과 자바 언어를 위한 정적 분석 틀 (A Framework for SBA for Java) KAIST 프로그램 분석시스템 연구단 세미나 창 병 모 숙명여대 전산학과.
자바 언어를 위한 정적 분석 (Static Analyses for Java) ‘99 한국정보과학회 가을학술발표회 튜토리얼
Representation, Syntax, Paradigms, Types
Advanced Compiler Design
Exception Handling and Event Handling
CMSC 202 Exceptions.
Exception Handling.
Presentation transcript:

1 Exception Analysis for Java Byeong-Mo Chang Sookmyung Women’s Univ., Korea

2 Contents Introduction Motivation Design of exception analysis Experiments and Related Works Conclusions

3 INTRODUCTION

4 Java overview Object oriented Type soundness –by Eisenbach97 and Nipkow98 Dynamic binding –inheritance and overriding Exception handling Concurrency

5 Constraint-based Analysis Constraint-based analysis [N. Heintze 1992] –static analysis framework for any languages –by defining set-constraint construction rules Constraint-based analysis –set-up constraints for programs by the rules –constraint solving algorithm Uncaught exception analysis –based on constraint-based analysis framework

6 MOTIVATION

7 Exceptions in Java Every exception is declared as –a subclass of “Exception” class Throw exceptions throw e Exception handling try { … } catch (E x) { … } Specify uncaught exceptions in method definition m(...) throws … { … }

8 Exceptions in Java Example class Demo { public static void main( ) { try { demoproc( ); } catch (Exception x) { ; } } void demoproc( ) throws Exception { try { throw new IOException("demo"); } catch (Exception x) { ; } }

9 Uncaught Exception Analysis in JDK Exception analysis –check whether thrown exceptions are caught or specified in the method definition –intra-procedural analysis based on programmer’s specifications. Not elaborate enough to –suggest for specialized handling nor –remove unnecessary handlers

10 Uncaught Exception Analysis We need an interprocedural analysis to –approximate all possible uncaught exceptions more precisely –independently of the programmer's specs. Exception analysis after class analysis –Assume Class(e) represents classes that are ``available'' at an expression e

11 Design of Exception Analysis

12 Deriving Set Constraints A set variable P e for every expression e –a set of names of uncaught exceptions from e. Construct set constraints of the form : P e  se This analysis assigns class names of possible uncaught exceptions of e to P e

13 Deriving Set Constraints Suppose e is each of the following expressions id = e 1 | P e  P e1 if e 0 then e 1 else e 2 | P e  P e0  P e1  P e2 throw e 1 | P e  Class(e 1 )  P e1 try e 0 catch (c x ) e 1 | P e  (P e0 - {c}*)  P e1 e 0.m(e 1 ) | - P e  P e0  P e1 - for each class c in Class(e 0 ) with a method m(x 1 ) = e m c  Class(e 0 )  P e  P e m

14 Experiments & Related Works

15 Experiments on Exception Analysis 2-pass exception analyzer at method-level implemented using yacc pass1 set-ups constraints pass2 solves the constraints Testbed UltraSparc Enterprise 450 running Solaris

16 No.programsDescriptionNum of class Num of method Num of lines Kinds of Exns 1StatisticianList methods statistics for a class JavaBinHex BinHex(.hqx) decompressor JHLZIP Compress into ZIP file JHLUNZIP Decompress ZIP file Com.ice.tarUnix Tar Archive Jess-Rete Reasoning Engine of Java Expert System Shell Benchmark Programs (available at

17 No.Throws spec Catch block Uncaugt Exn Unnecessary throws Unnecessary catch Broader throws Broader catch (1) (0) (0) 03 (1)4 (2) (0)013 (2) Experimental Results ( ) : JDK results

18 Execution Time Jess-Rete Com.ice.tar 0.01 JHLUNZIP JHLZIP JavaBinHex Statistician Solving time (sec) Set-up time (sec) Programs

19 Related works Exception analysis for ML – constraint-based [Fahndrich&Aiken96 ], [Yi&Ryu97], – type and effect [Pessaux&Leroy99 ] Exception analysis for Java –designed with class analysis at method-level [Yi and Chang 99] Jex –A tool for a view of the exception flow [Robillard and Murphy 99]

20 Conclusions Exception analysis –a kind of program verification tool –can be incorporated in Java IDE Further works –Generalize sparse analysis by rule transformation –side-effect, security, synchronization