首页 | 官方网站   微博 | 高级检索  
相似文献
 共查询到17条相似文献,搜索用时 203 毫秒
1.
异常处理机制能增强程序运行的可靠性,提高软件的健壮性,但异常处理代码本身可能存在错误.由于它的特殊性。采用与测试普通代码同样的方法对其进行测试,通常效率不高而且很难达到预期的效果.在分析了利用断言违背策略进行软件故障注入技术的基础上,提出了将Java异常处理机制的特殊结构同断言违背策略、程序变异技术相结合,可以有效地测试异常处理代码。并设计工具来支持这种故障注入方法.  相似文献   

2.
异常处理是现代程序设计语言提供的用来提高软件健壮性的一种机制。由于在C^++的函数界面中并不要求声明该函数所能传播出的异常的类型,所以要想提高系统的健壮性,必须清楚在程序的执行过程中可能引发的异常、异常的传播路径等。然而在大型系统中,要想确定这些信息是非常困难的。本文针对C^++的异常处理机制,首先提出了一个描述C^++异常结构信息的模型,并把该模型应用于递归函数中。然后,描述了一个基于该模型的分析C^++程序异常结构信息的工具CETool。该工具能提供所有显式引发异常的有关信息,为系统中异常处理结构的改进和程序的结构测试提供有价值的信息。最后给出了该工具的实现方法和应用实例。  相似文献   

3.
异常处理机制能增强程序运行的可靠性,提高软件的健壮性.然而,如果异常处理机制使用不当,会带来许多潜在的错误,因而很有必要对程序的异常处理结构进行测试.提出了一种识别被测程序中的所有异常变量"定义-使用"关系的方法,并使用一个异常的定义-捕获度量来计算异常定义-使用链的测试覆盖.最后设计了一种异常分析及测试的原型工具.  相似文献   

4.
异常处理是程序开发的一个重要内容,异常处理的好坏关系到程序的友好程度和系统的稳定性。C++是一种纯面向对象的编程语言,其异常处理机制和普通的编程语言有很多不同的地方,有力地增强了C++程序的健壮性和容错性。文中从介绍其运行步骤入手,通过一个简单的例子,详细阐述了C++异常处理机制的规则和栈展开技术,并扼要地对比了函数调用和异常处理的异同点,以便更好地在C++面向对象程序设计中正确使用异常处理机制。  相似文献   

5.
一种基于异常传播分析的数据流分析方法   总被引:8,自引:0,他引:8  
异常处理是一种用来检测异常并对其进行处理的技术.异常传播改变了程序原来的执行路线,从而改变了程序中的数据流.在进行数据流分析时,如果不考虑异常传播对其造成的影响,则得到的信息将是不准确的.在分析C++异常传播机制和异常传播对数据流分析影响的基础上,提出一种包含异常传播信息的函数间控制流图的构建方法.该控制流图可以清晰地表示出异常的隐式控制流和异常的传播路径;然后提出了基于异常传播分析的数据流分析方法,并给出相应的算法.该方法既克服了因忽略异常传播对数据流影响而造成分析结果不准确的不足,又有助于实现异常传播数据流分析的自动处理;最后用一个实例验证了该方法的可用性.该方法可以为结构测试、回归测试、程序切片等软件工程任务提供相关信息.  相似文献   

6.
Java异常处理策略研究   总被引:1,自引:0,他引:1  
异常处理机制是程序设计语言的重要标志之一,在程序设计过程中用来处理程序运行中的异常。传统的程序设计语言里异常处理较为繁杂。Java是一种面向对象的程序设计语言,且引入了异常处理机制。合理完备的异常处理可以增强程序运行的可靠性、提高软件的健壮性,可以较为快速地确定错误的位置。文章分析了Java异常处理的逻辑,阐述了异常类、异常处理机制以及异常处理方法,提出了异常处理的一些策略。综合运用这些策略可以使编程人员编写出更加简洁、高效的程序代码。  相似文献   

7.
异常处理机制是程序设计语言的重要标志之一,在程序设计过程中用来处理程序运行中的异常.传统的程序设计语言里异常处理较为繁杂. Java 是一种面向对象的程序设计语言,且引入了异常处理机制.合理完备的异常处理可以增强程序运行的可靠性、提高软件的健壮性,可以较为快速地确定错误的位置.文章分析了 Java 异常处理的逻辑,阐述了异常类、异常处理机制以及异常处理方法,提出了异常处理的一些策略.综合运用这些策略可以使编程人员编写出更加简洁、高效的程序代码.  相似文献   

8.
程序设计语言异常处理机制   总被引:5,自引:0,他引:5  
介绍程序设计语言异常处理的基本概念,对C++、CLU、Eifel几种语言中的异常处理进行了说明与比较,并就如何利用这种机制提高软件可靠性进行了讨论。  相似文献   

9.
异常处理是现代程序设计语言的一个重要特征,它为检测和恢复软件系统在运行时的错误、构建系统的容错处理提供了强有力的支持。本文分析了FORTRAN 2000的异常处理机制,并提出一种扩充方案,引入用户定义异常和异常处理区的概念,改进了异常的传播机制,从而使FORTRAN编程更好地实现普通代码和异常处理代码的分离,提高了程序的可读性和可维护性。  相似文献   

10.
Java程序运行期间发生的错误称为异常.异常产生后,应有相应的异常处理机制来捕获异常或抛出异常。JDK平台为我们提供了丰富和完整的异常类,通过它们来处理程序运行中的错误,防止错误对程序造成影响,确保程序能够安全运行。当这些异常类不能捕获实际应用中的异常时.就需要用户自定义异常。异常处理和用户自定义异常的正确与灵活运用:将有效地增强程序的交互性。增加程序的完整性。  相似文献   

11.
As aspects extend or replace existing functionality at specific join points in the code, their behavior may raise new exceptions, which can flow through the program execution in unexpected ways. Assuring the reliability of exception handling code in aspect-oriented (AO) systems is a challenging task. Testing the exception handling code is inherently difficult, since it is tricky to provoke all exceptions during tests, and the large number of different exceptions that can happen in a system may lead to the test-case explosion problem. Moreover, we have observed that some properties of AO programming (e.g., quantification, obliviousness) may conflict with characteristics of exception handling mechanisms, exacerbating existing problems (e.g., uncaught exceptions). The lack of verification approaches for exception handling code in AO systems stimulated the present work. This work presents a verification approach based on a static analysis tool, called SAFE, to check the reliability of exception handling code in AspectJ programs. We evaluated the effectiveness and feasibility of our approach in two complementary ways (i) by investigating if the SAFE tool is precise enough to uncover exception flow information and (ii) by applying the approach to three medium-sized ApectJ systems from different application domains.  相似文献   

12.
薛岗  叶小虎  张楠  姚绍文 《计算机科学》2011,38(11):131-136
业务流程运行期间,外部或运行环境中的某些属性与流程设计时所设定的条件不一致时,将导致流程运行时的违例,违例处理方法涉及流程运行时违例的发现和处理。首先介绍了流程的违例及其分类;基于流程违例处理模式,使用CCS偶图对流程工作项级、案例级违例处理以及相关补偿处理进行分析和表述;在违例处理策略讨论的基础上,总结了违例处理模式的基本形式,并通过CCS偶图的动态特征分析了违例处理的动态行为。  相似文献   

13.
Java uses exceptions to provide elegant error handling capabilities during program execution. However, the presence of exception handlers complicates the job of the just‐in‐time (JIT) compiler, while exceptions are rarely used in most programs. This paper describes two techniques for reducing such complications. First, we delay the translation of an exception handler until the exception really occurs. This on‐demand translation of exception handlers allows more optimizations when translating the main flow, without being hindered by constraints caused by the exception flows. Secondly, for those exceptions that are actually thrown during program execution we insert exception‐type check code and a direct branch to the translated exception handlers. This exception handler prediction is motivated by an observation that frequently thrown exceptions are likely to be handled by the same exception handlers, so this will eliminate the exception processing overhead of the Java virtual machine. Our experiments indicate that the code quality of the main flow is no longer affected by the presence of exception handlers. Also, frequently thrown exceptions can be efficiently handled by the exception handler prediction. Copyright © 2004 John Wiley & Sons, Ltd.  相似文献   

14.
唐珺 《计算机安全》2010,(12):63-65
程序设计中,异常是一个不可忽略的元素,因此,有效的异常处理是程序完善的重要标志。重点介绍了C#语言中的异常处理机制。主要包括异常的基础知识、异常处理机制、程序设计中的异常三个部分。异常基础知识部分,讲解了什么是异常,异常发生的情况及主要的异常类,使读者对程序异常有基本的认识。异常处理机制部分,从应用程序和理论两方面对C#语言中对异常的处理机制进行讲解,详细分析了三种异常处理语句。程序设计中的异常部分,通过一个简单的程序开发中的例子扩展异常机制在程序设计中的应用,拓宽软件开发人员的设计思路。  相似文献   

15.
一种分析异常传播路径的方法   总被引:1,自引:1,他引:0       下载免费PDF全文
异常的传播会给程序的分析、理解、测试和维护工作带来很多困难。为了解决目前在分析异常传播路径中表示方法过于复杂的问题,该文针对C++的异常机制建立异常控制流图模型,在分析异常在传播过程中各种关系的基础上建立异常传播图模型,并对异常传播图在结构测试中的应用进行讨论。使用该模型可以准确清晰地表示出异常传播的路径,大大简化异常传播路径的分析。  相似文献   

16.
Since the signature of an Ada subprogram does not specify the set of exceptions that the subprogram can propagate, computing the set of exceptions that a subprogram may encounter is not a trivial task. This is a source of error in large Ada systems: for example, a subprogram may not be prepared to handle an exception propagated from another subprogram several layers lower in the call-tree. In a large system, the number of paths in exceptional processing is so great that it is unlikely that testing will uncover all errors in inter-procedural exception handling. Nor are compilers or code inspections likely to locate all such errors. Exception handling is an area where static analysis has a high potential payoff for systems with high reliability requirements. We discuss fundamental notions in computing exception propagation and describe an analysis tool that has proved to be effective in detecting inconsistencies in the exception-handling code of Ada applications.  相似文献   

17.
It is more important to properly handle exceptions, than to prevent exceptions from occurring, because they arise from so many different causes. In embedded systems, a vast number of exceptions are caused by hardware devices. In such cases, numerous software components are involved in these hardware device-originated exceptions, ranging from the device itself to the device driver, the kernel, and applications. Therefore, it takes a lot of time to debug software that fails to handle exceptions. This paper proposes a lightweight device exception testing method, and a related automation tool, AMOS v3.0. The proposed method artificially triggers more realistic device exceptions in runtime, and monitors how software components handle exceptions in detail. AMOS v3.0 has been applied to the exception testing of car-infotainment systems in an automobile company. The results based on this industrial field study have revealed that 39.13% of the failures in exception handling were caused by applications, 36.23% of the failures were caused by device drivers, and 24.64% were derived from the kernel. We conclude that the proposed method is highly effective, in that it can allow developers to identify the root cause of failure for exception handling.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司    京ICP备09084417号-23

京公网安备 11010802026262号