WWW.THESIS.DISLIB.INFO
FREE ELECTRONIC LIBRARY - Online materials, documents
 
<< HOME
CONTACTS



Pages:   || 2 |

«An Exception Monitoring System for Java Heejung Ohe and Byeong-Mo Chang Department of Computer Science, Sookmyung Women’s University, Seoul ...»

-- [ Page 1 ] --

An Exception Monitoring System for Java

Heejung Ohe and Byeong-Mo Chang

Department of Computer Science,

Sookmyung Women’s University,

Seoul 140-742, Korea

{lutino, chang}@sookmyung.ac.kr

Abstract. Exception mechanism is important for the development of

robust programs to make sure that exceptions are handled appropriately

at run-time. In this paper, we develop a dynamic exception monitoring

system, which can trace handling and propagation of thrown exceptions

in real-time. With this tool, programmers can examine exception handling process in more details and handle exceptions more effectively. Programmers can also trace only interesting exceptions by selecting options before execution. It can also provides profile information after execution, which summarizes exception handling in each method during execution.

To reduce performance overhead, we implement the system based on code inlining, and presents some experimental results.

Keywords: Java, exception propagation, exception analysis.

1 Introduction Exception handling is important in modern software development because it can support the development of robust programs with reliable error detection, and fast error handling. Java provides facilities to allow the programmer to define, throw and catch exceptional conditions. Because uncaught exceptions will abort the program’s execution, it is important for the development of robust programs to make sure that exceptions are handled appropriately at run-time. However, it is not easy for programmers to trace and handle exceptions effectively.

A number of static exception analyses including our previous works have been proposed based on static analysis framework [2, 3, 9, 10]. They approximate all possible exceptions, and don’t consider unchecked exceptions usually. The static analysis information is usually used to check that all uncaught (checked) exceptions are specified in the method header. They, however, are not able to provide exact information on how exceptions are thrown, caught and propagated at runtime.

To assist developing robust software, we need a tool to trace or monitor raised exceptions effectively during execution. For example, J2ME Wireless Tool This Research was supported by the Sookmyung Women’s University Research Grants 2004.

N. Guelfi (Ed.): RISE 2004, LNCS 3475, pp. 71–81, 2005.

c Springer-Verlag Berlin Heidelberg 2005 72 H. Ohe and B.-M. Chang Kit(WTK), a dynamic analysis tool, provides just the names of exceptions, whenever exceptions are thrown, but it cannot trace how thrown exceptions are handled and propagated. In addition, J2ME WTK is too slow when tracing exceptions, because it relies on JVMPI. Programmers cannot trace propagation and handling of exceptions with this tool. To develop reliable and robust Java programs, programmers need a more powerful tool, which can trace exception propagation and exception handling during execution.

In this paper, we develop a dynamic exception monitoring system, which can trace how thrown exceptions(including unchecked exceptions) are handled and propagated in real-time. Programmers can examine exception handling process in more details and handle exceptions more effectively. Moreover, programmers can trace only interesting exceptions by selecting options before execution. It also provides profile information after execution, which summarizes exception handling in each method during execution.

To reduce performance overhead, we design the system based on code inlining.

Input programs are transformed by inlining codes so as to trace only interesting exceptions according to user options. The transformed programs produce trace information during execution, and profile information after execution. We implement the event monitoring system in Java based on Barat [1], which is a front-end for a Java compiler. We also present some experimental results, which can show the effectiveness of the system.

The rest of this paper is organized as follows. The next section gives preliminaries on exceptions. Section 3 describes overall design of the system. Section 4 describes the implementation of the system, and Section 5 presents some experiments. Section 6 concludes this paper and discusses further research topics.

2 Preliminaries Like normal objects, exceptions can be defined by classes, instantiated, assigned to variables, passed as parameters, etc. Exception facilities in Java allow the programmer to define, throw and catch exceptional conditions. The throw statement throw e0 evaluates e0 first, and then throws the exception object. The try statement try S1 catch (c x) S2 evaluates S1 first. If the statement S1 executes normally without thrown exception, the try-catch statement executes normally. If an exception is thrown from S1 and its class is covered by c then the handler expression S2 is evaluated with the exception object bound to x.

If the thrown exception is not covered by class c then the thrown exception continues to propagate back along the call chain until it meets another handler.

The programmers have to declare in a method definition any exception class whose exceptions may escape from its body. The formal semantics of Java was proposed in [5] with exception throwing, propagation and handling taken into consideration.

Let’s consider a simple example in Figure 1, which shows exception propagation. The thrown exception E1 from the method m2 is propagated through m2 and m1, and caught by the try-catch in the main method. The exception An Exception Monitoring System for Java 73

–  –  –





E2 may be thrown from the method m3. If it is thrown, then it is propagated until the main method and not caught. The method m3 also has a recursive call to itself, so that the thrown exception E2 may be propagated back through the recursive calls.

Because uncaught exceptions will abort the program’s execution, it is important for the development of robust programs to check that exceptions are handled appropriately at run-time.

3 Design Considerations There are several ways that monitors can mediate all application operations. A traditional reference monitor is implemented by halting execution before certain machine instructions and invoking the reference monitor with the instruction as input. An alternate implementation, not limited by hardware support, runs applications inside an interpreter like JVM that executes the application code and invokes a reference monitor before each instruction. JVMPI(JVM Profiler Interface) follows this approach. However, this approach has unacceptable performance overhead [6], since a cost is incurred on every executed instruction. The third option inlines reference monitors in the target software. This approach is shown to overcome the limitations of traditional reference monitors, yet exhibits reasonable performance [6].

74 H. Ohe and B.-M. Chang

–  –  –

An inlined reference monitor is obtained by modifying an application to include the functionality of a reference monitor. As in Figure 2, IRMs are inserted into applications by a rewriter or transformer that reads a target application and a policy, and produces a secured application, whose execution monitors its execution. The inlining approach is shown to be efficient for monitoring Java programs in [6].

We follow the inlining approach to design a dynamic exception monitoring system for efficiency. We take the following things into consideration in the design.

The first one is to provide users with options to select interesting exceptions.

By selecting options before execution, users can focus on interesting exceptions and methods by tracing only interesting exceptions in real-time. This option can also contribute in reducing performance overhead, because it makes the system to trace only interesting exceptions instead of all exceptions. The second one is to provide a profile option to produce profile information after execution, which summarizes exception throwing and handling during execution. The third one is to reduce performance overhead. We try to reduce performance overhead by inlining code instead of using JVMPI. An input program P is transformed into a An Exception Monitoring System for Java 75 program P by inlinig codes so as to trace only interesting exceptions according to user options. The transformed program P will trace how thrown exceptions are handled and propagated during execution, and give profile information on exception handling after execution.

Overall architecture of the system is shown in Figure 3. This system consists

of four steps as in Figure 3. The function of each step is as follows:

The first step extracts exception-related constructs by static analysis. This static information is used to give users options. The second step is option selection, where users can select interesting exceptions and methods using the static exception information. Users can trace only interesting exceptions and methods by selecting options in this step. The third step is a transformer, which transforms an input program P into a program P by inlining codes so as to trace only interesting exceptions according to user options. The fourth step is to compile and execute the transformed program P. It is to be executed on Java 2 SDK or J2ME WTK.

4 Implementation The exception monitoring system is implemented in Java based on Barat [1], which is a front-end for a Java compiler. Barat builds an

Abstract

syntax tree for an input Java program and enriches it with type and name analysis information. It also provides interfaces for traversing abstract syntax trees, based on visitor design pattern in [7]. We can traverse AST nodes and do some actions

or operations at visiting each node using a visitor, which is a tree traverse routine based on design patterns. Barat provides several visitors as basic visitors:

DescendingVisitor which traverses every AST node in depth-first order and OuputVisitor which outputs input programs by traversing AST nodes. We can develop a static analyzer by implementing visitors to do necessary actions or operations at visiting AST nodes by extending basic visitors [1].

As described in Figure 3, our system consists of four steps. We implement the first three steps. The last step is a real execution on Java SDK.

A main window for selecting options is shown in Figure 5, which shows all files in the package of a benchmark program Check from specjvm98. After users select files from the package, the window displays a list of exceptions, handlers and methods based on the static analysis information. Then, users can select only interesting exceptions, handlers and methods among them. By selecting options, users can get only interesting trace information and focus on interesting exceptions when debugging.

–  –  –

Class TransformVisitor extends OutputVisitor{ visitThrow{ // Print the location of thrown exception and its type } visitTry{ // Print the location of try statement } visitCatch{ // Print the location of catch statement, the type of caught exception // call printStackTrace() method } visitMethod{ // Print the method information and record exception propagation // via this method } }

–  –  –

To provide users with options, we implement a static analyzer to extract exception-related constructs by extending DescendingVisitor. It extracts static information about possible exceptions and methods by analyzing input programs statically. In particular, it extracts static program constructs on exception raising, handling and methods.

We implement a program transformer called TransformVisitor by extending OuputVisitor, which transforms an input program P into a program P by inlining codes so as to trace handling and propagation of thrown exceptions according to selected options. Figure 6 shows overall structure of the program transformer.

A fragment of the transformed Check program is displayed in Figure 7. This figure shows main method and syncMethod2 which is called from the main method. The codes in the box are inlined codes by the transformer. The transformed program is to be executed automatically in Java 2 SDK. This transformed code traces how thrown exceptions are handled and propagated in real-time during execution. In addition, it can also profile exception handling of each method during execution and shows the number of thrown, caught, and uncaught exceptions for each method after execution.

5 Experiments We have implemented the system with SDK 1.4.2 on Pentium 4 processor and Window XP. We first tested it with Check from specjvm98, which is a program to check that the JVM fits the requirements of the benchmark.

78 H. Ohe and B.-M. Chang When we execute the transformed program, we can trace handling and propagation of thrown exceptions (including runtime exceptions) as in Figure 8. It shows the location and exception type when an exception is thrown. It also shows the propagated path when an propagated exception is caught by a catchclause. For example, the propagation path of ArithmeticException, when it is caught at line 659, is shown in Figure 8 When the program terminates, it profiles the thrown, caught, and propagated exceptions of each method. Figure 9 shows the names and numbers of thrown, caught and propagated exceptions of each method. It also shows the name of exceptions, which is specified by throws clause at method headers. For example, ArithmeticException is specified at PepTest.syncMethod2.

Fig. 8. Trace of Check program

We have experimented the system with five Java benchmark programs. The first one is the small server connecting program ServerStuff. The second one is Linpack benchmark, which is to solve a dense system of linear equations. The third one is Check from specjvm98. The fourth one is Jess from specjvm98, which is an expert system shell based on NASA’s CLIPS program. The last one is Rex from gnu, which matches a regular expression against strings.

Table 1 first shows the numbers of lines of benchmark programs before and after inlining, and then shows the number of thrown exceptions, the number of caught exceptions, and the number of propagated exceptions for each benchmark.

If an exception is propagated, it is counted as propagated exceptions at every An Exception Monitoring System for Java 79

–  –  –



Pages:   || 2 |


Similar works:

«GUIDANCE FOR USE OF TABU VENEERS & TECHNICAL RECOMMENDATIONS VERY IMPORTANT READ THIS To produce an item of beauty great care needs to be taken. It is absolutely essential that the Technical Recommendations for Use (sent with your sample, Order Confirmation and Delivery Note) are read & followed. They can be downloaded on www.mundyveneer.com or email info@mundyveneer.com for a copy. It is an inherent characteristic of wood that due to environmental moisture, heat and light the colour will...»

«The VAC Renaissance Mk II Master Control Triode Preamplifier Operation & Maintenance Information Valve Amplification Company Manual revised 06/22/2004 CAUTION THE PREAMPLIFIER AND POWER SUPPLY CONTAIN NO USER SERVICEABLE PARTS. DO NOT REMOVE THE BOTTOM PLATES OR CHASSIS COVERS. LETHAL VOLTAGES ARE PRESENT WITHIN THE CHASSIS. DO NOT OPERATE THE UNITS IF THEY ARE WET. VACUUM TUBES BECOME HOT ENOUGH TO CAUSE SERIOUS BURNS. NEVER TOUCH A TUBE WHEN THE UNIT IS ON. IT MAY TAKE SEVERAL MINUTES FOR THE...»

«Whitepaper | AirMagnet | March 06, 2008 Impact of Legacy Devices on 802.11n Networks The 802.11n specification defines several mechanisms by which HT (High Throughput) STAs may coexist with non-HT (802.11a/b/g) STAs. This concept (and many of the procedures for doing so) is not new, or unique to 802.11n. In fact, many of the issues of coexistence and backwards compatibility are present in 802.11g whereby protection mechanisms are employed allowing ERP (802.11g) STAs to coexist with HR/DSSS...»

«13 Theoretical Approaches to Employment and Industrial Relations: A Comparison of Subsisting Orthodoxies Christopher Odogwu Chidi1 and Okwy Peter Okpala2 1Department of Industrial Relations & Personnel Management, University of Lagos, 2Department of Accounting, University of Lagos, Nigeria 1. Introduction Theory could be viewed as a coherent group of assumptions or propositions put forth to explain a phenomenon. A theory is an abstraction of reality and is synonymous with perception, viewpoint,...»

«Chapter 2 Propositionaland Predicate-Calculus Preliminaries This chapter prepares for the extensive account of our verifier system given in Chap. 4 by describing and analyzing two of the system’s basic ingredients, the propositional calculus, from which we take all necessary properties of the logical operations &, ∨, ¬, →, and ↔, and the (first-order) predicate calculus, which to these propositional mechanisms adds compound functional and predicate constructions and the two...»

«The Tain of Hamlet The Tain of Hamlet By Laurie Johnson The Tain of Hamlet, by Laurie Johnson This book first published 2013 Cambridge Scholars Publishing 12 Back Chapman Street, Newcastle upon Tyne, NE6 2XX, UK British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library Copyright © 2013 by Laurie Johnson All rights for this book reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted, in any form...»

«Veiled Nonlocality and Cosmic Censorship Menas Kafatos1,a) and Subhash Kak2 1. Chapman University, Orange, CA 92866, USA 2. Oklahoma State University, Stillwater, OK 74078, USA Abstract. The premise that consciousness has a quantum mechanical basis or correlate implies that its workings have a nonlocal component. To check whether consciousness as an entity leaves a physical trace, we propose that laboratory searches for such a trace should be for nonlocality, where probabilities do not conform...»

«Lesson plan for web module: Recording the Grandeur of the Qing READING A HAND SCROLL: The Kangxi Emperor’s Southern Inspection Tour Christine Naitove, the Chapin School, New York, New York I. Introduction a. Guiding Questions b. Learning Objectives c. Source Materials d. Important Terms II. Background a. The Qing Empire and Inspection Tours of the Realm • Scroll III – Mt. Tai • Scroll IV – The City of Suzhou b. The Orthodox School of Painting • Orthodox Painters under the Qing •...»

«Article The Gender of Precarious Employment in Canada Cynthia J. Cranford, Leah F. Vosko et Nancy Zukewich Relations industrielles / Industrial Relations, vol. 58, n° 3, 2003, p. 454-482.Pour citer cet article, utiliser l'information suivante : URI: http://id.erudit.org/iderudit/007495ar DOI: 10.7202/007495ar Note : les règles d'écriture des références bibliographiques peuvent varier selon les différents domaines du savoir. Ce document est protégé par la loi sur le droit d'auteur....»

«PMC Decade The First Ten Years of Precious Metal Clay copyright 2006 Brynmorgen Press Book design by Tim McCreight Cover image: Coba, Brooch, Claire Holliday fine silver, fine gold. 13⁄8 For ordering and permissions, All rights reserved. No part of this publication visit www.brynmorgen.com may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any storage and retrieval system except by a ISBN 978-1-929565-19-1 reviewer who...»

«Large Scale Detection of Irregularities in Accounting Data1 Stephen Bay, Krishna Kumaraswamy, Markus G. Anderle, Rohit Kumar, David M. Steier Center for Advanced Research, PricewaterhouseCoopers LLP 10 Almaden Blvd, Suite 1600, San Jose, CA 95113 {firstname.initial.lastname}@us.pwc.com Abstract In recent years, there have been several large accounting frauds where a company's financial results have been intentionally misrepresented by billions of dollars. In response, regulatory bodies have...»

«TE AM FL Y WHO’S AFRAID OF ADAM SMITH? WHO’S AFRAID OF ADAM SMITH? HOW THE MARKET GOT ITS SOUL PETER J. DOUGH ERT Y JOHN WILEY & SONS, INC. Copyright © 2002 by Peter J. Dougherty. All rights reserved. Published by John Wiley & Sons, Inc., Hoboken, New Jersey. Published simultaneously in Canada. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise,...»





 
<<  HOME   |    CONTACTS
2017 www.thesis.dislib.info - Online materials, documents

Materials of this site are available for review, all rights belong to their respective owners.
If you do not agree with the fact that your material is placed on this site, please, email us, we will within 1-2 business days delete him.