CN104331367A - Method and system for exception handling in Java engineering project development - Google Patents

Method and system for exception handling in Java engineering project development Download PDF

Info

Publication number
CN104331367A
CN104331367A CN201410645204.0A CN201410645204A CN104331367A CN 104331367 A CN104331367 A CN 104331367A CN 201410645204 A CN201410645204 A CN 201410645204A CN 104331367 A CN104331367 A CN 104331367A
Authority
CN
China
Prior art keywords
exception
subclass
layer
program
top layer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410645204.0A
Other languages
Chinese (zh)
Inventor
李新虎
胡玉鹏
于辉
刘正伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201410645204.0A priority Critical patent/CN104331367A/en
Publication of CN104331367A publication Critical patent/CN104331367A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a method and a system for exception handling in Java engineering project development. The method comprises the following steps: defining a program exception subclass and a business exception subclass in a run-time exception class; throwing exceptions belonging to the program exception subclass and the business exception subclass to an upper level by a low level below a top level during the engineering project development; intensively capturing the exceptions, which belong to the program exception subclass and the business exception subclass and are thrown by the low level, by the top level, and converting into corresponding prompt information after the captured exceptions are processed. According to the method and the system disclosed by the invention, the program exception subclass and the business exception subclass are defined in the run-time exception class; exception detection is not performed by the low level, and a corresponding try catch block is correspondingly cancelled, so that the code of the top level and the code of the low level are very simple, code logics are clear, the programming style can be unified, and the reusability of the codes is improved.

Description

The method and system of abnormality processing in the exploitation of Java engineering project
Technical field
The present invention relates to Java engineering project software development technique, particularly relate to the method and system of abnormality processing in the exploitation of Java engineering project.
Background technology
In Java project development process, for the demand of business, in performance history, polytype abnormality processing can be defined.Abnormal definition is generally used for the information of attention program run-time error, also may be used for the unexpected computing of pointing out unusual traffic operation and generation; It has very great effect to the ease for use aspect of program development, debugging, secondary development and program.This is also one of characteristic of Java programming.In a word, correctly use exception handling, contribute to the robustness of raising program, namely refer to that program can normally be run as a rule, return the correct result of expection; If fall in abnormal conditions, program also can take thoughtful solution.
Sun Microsystems defines the abnormality processing framework of Java, is divided into run-time exception and checks abnormal.Run-time exception represents the exception that program recovery cannot be allowed to run, and causes this abnormal reason normally owing to performing faulty operation, if that is wrong in program code, just may cause run-time exception.Once there is faulty operation, suggestion terminator, therefore Java compiler has not checked this exception.Check that abnormal is the manageable exception of representation program, if the method for throw exception itself can not process it, so method call person should go to process it, thus program recovery is run, and is unlikely to terminator.As can be seen here, run-time exception should be avoided as far as possible, in the program debug stage, runs into the Design and implementation mode that the correct way of this exception is improvement program, the mistake in update routine, thus avoids this exception.In Java engineering development process, because technical merit is uneven, team requires the reasons such as disunity, most engineering adopts inspection extremely to process code logic, cause Java code readability to reduce, size of code increases, the mixed opinion of code logic, the problem of coding style disunity etc., reduces readability and the reusability of program.
Therefore, the exploitation of Java engineering project is needed badly provides a kind of disposal route that can replace checking with run-time exception exception, to simplify the abnormality processing of projects exploitation.
Summary of the invention
Technical matters to be solved by this invention is to provide the method and system of abnormality processing in the exploitation of a kind of Java engineering project, can simplify the abnormality processing of projects exploitation.
In order to solve the problems of the technologies described above, the invention provides the method for abnormality processing in the exploitation of a kind of Java engineering project, comprising:
The operationally abnormal subclass of define program and service exception subclass in exception class;
Low layer in engineering project performance history under top layer is all dished out to upper strata and is belonged to the exception of program exception subclass and service exception subclass;
Concentrated the exception belonging to program exception subclass and service exception subclass of catching low layer upthrow by top layer, and convert corresponding information to after processing the exception of catching.
Further,
Low layer under top layer is respectively the Business treatment that data are looked for object layer and looked for object layer higher than data, and Business treatment is looked for object layer for described data and thrown the exception come and directly throw to and belong to the top layer of last layer;
Top layer refers to key-course or execution level.
Further,
Except the exception that low layer belongs to program exception subclass and service exception subclass except dishing out to upper strata, the exception of being dished out by third party's program of also dishing out to upper strata;
Top layer is caught except the exception belonging to described program exception subclass and service exception subclass of low layer upthrow except concentrating, and also catches the exception of being dished out by third party's program of low layer upthrow, and converts corresponding information to after processing the exception of catching.
In order to solve the problems of the technologies described above, the invention provides the system of abnormality processing in the exploitation of a kind of Java engineering project, comprising the abnormal subclass definitions module, low layer exception throws module and the top layer abnormality processing module that connect successively, wherein:
Abnormal subclass definitions module, for the abnormal subclass of define program and service exception subclass in operationally exception class;
Low layer exception throws module, is arranged on the low layer of top layer, and this layer of exception belonging to program exception subclass and service exception subclass for dishing out to upper strata in engineering project performance history or lower floor throw the exception come;
Top layer abnormality processing module, for being concentrated the exception belonging to program exception subclass and service exception subclass of catching low layer upthrow by exception catching unit, by the exception that exception processing unit process is caught, then convert the exception of process to corresponding information by information conversion unit.
Further,
Low layer exception throws module installation, at the low layer of top layer, refers to that being separately positioned on data looks for object layer and be arranged on the Business treatment of looking for object layer higher than data; In the low layer exception throws module of Business treatment, the exception come is thrown for the low layer exception throws module of looking for object layer in data directly to throw to and belong to the top layer of last layer;
Top layer abnormality processing module installation is at key-course or execution level.
Further,
Low layer exception throws module is thrown except the exception come except dish out to upper strata in engineering project performance history this layer of exception belonging to program exception subclass and service exception subclass or lower floor, this layer of also dishing out to upper strata or lower floor throw the exception of being dished out by third party's program come;
Top layer abnormality processing module is caught except the exception belonging to program exception subclass and service exception subclass of low layer upthrow except being concentrated by exception catching unit, also concentrates the exception of being dished out by third party's program of catching low layer upthrow; By the exception that exception processing unit process is caught, then convert the exception of process to corresponding information by information conversion unit.
The present invention cancels data in Java programming and looks for object (Dao, Data Access Object) layer, business processing (Sevice) layer is to checking the inspection of Exception Type, replace with run-time exception type RuntimeException, and operationally definition two subclasses in exception class: program exception subclass and service exception subclass.Thus, the present invention carries out checking abnormal process owing to not needing Dao layer and Service layer, therefore the corresponding corresponding cancellation of try catch block, thus make the code of the following layer of top layer very succinct, improve the readability of Java code, also greatly reduce size of code, make code logic clear, also can unify coding style, improve the reusability of code.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of the embodiment of the method for abnormality processing in Java engineering project of the present invention exploitation;
Fig. 2 is the schematic diagram by the embodiment of the method shown in Fig. 1;
Fig. 3 is the structured flowchart of the system embodiment of abnormality processing in Java engineering project of the present invention exploitation.
Embodiment
Below in conjunction with accompanying drawing and preferred embodiment, technical scheme of the present invention is set forth in detail.Should be appreciated that, the embodiment below enumerated only for instruction and explanation of the present invention, and does not form the restriction to technical solution of the present invention.
As shown in Figure 1, illustrate the flow process of the embodiment of the method for abnormality processing in Java engineering project of the present invention exploitation, comprise the steps:
110: the operationally abnormal subclass of define program and service exception subclass in exception class;
Wherein, program class extremely program produces because of data transmission, is avoidable exception; Service exception is because not the meeting business demand of bottom to be fed back to the exception stream of web user, through being commonly used to carry the information such as error code by service needed.
120: the low layer in engineering project performance history under top layer is all dished out to upper strata and belonged to the exception of definition subclass;
Here, the low layer of top layer is respectively Dao layer (a program virtual layer of coming into contacts with database in programming project) and Sevice layer (is positioned on Dao layer, the kernel program virtual level of various logic Automated generalization), they are dished out to upper strata and belong to the exception of program exception subclass and service exception subclass respectively, as shown in Figure 2.
This two-layer throw exception, does not process exception.Dao layer is thrown to the exception come, Service layer is left intact, last layer of just directly throwing to.All do not need because this is two-layer to process abnormal, a large amount of try catch blocks would not be occurred in code, make code seem very succinct.
130: the exception being concentrated the definition subclass of catching low layer upthrow by top layer, and corresponding information is converted to after processing the exception of catching.
Here, top layer refers to control (Controller) layer or execution (Action) layer.Concentrated by top layer and to be caught by try catch block and to process that these are abnormal, finally change into information prompting, refer to Fig. 2.The information changed into is pointed out such as: " user does not exist ", " resource is finished ", " hind computation is made mistakes " and " hind computation hurries " etc. information, and at top layer, the situation that process is abnormal is write as daily record, is stored in system database.
By top layer focusing on run-time exception, the object of " not re-treatment is abnormal, does not repeat log " can be reached.
In said method embodiment,
Step 120 low layer in engineering project performance history belongs to except the exception of definition subclass except dishing out to upper strata, the exception of being dished out by third party's program of also dishing out to upper strata;
Step 130 is caught except the exception of definition subclass of low layer upthrow by top layer except concentrating, and also catches the exception of being dished out by third party's program of low layer upthrow, and converts corresponding information to after processing the exception of catching.
When the third-party program of the Calling that engineering project is developed, if there is operation mistake, the generation of some exceptions also can be caused.These equally all focus at top layer extremely.
The present invention is directed to said method embodiment, correspondingly additionally provide the system embodiment of abnormality processing in the exploitation of Java engineering project, its structure as shown in Figure 3, comprises the abnormal subclass definitions module, low layer exception throws module and the top layer abnormality processing module that connect successively, wherein:
Abnormal subclass definitions module, for the abnormal subclass of define program and service exception subclass in operationally exception class;
Low layer exception throws module, for arranging the low layer of top layer, this layer of exception belonging to program exception subclass and service exception subclass of dishing out to upper strata in engineering project performance history or lower floor throw the exception come;
Top layer abnormality processing module, for being concentrated the exception belonging to program exception subclass and service exception subclass of catching low layer upthrow by exception catching unit, by the exception that exception processing unit process is caught, then convert the exception of process to corresponding information by information conversion unit.
In said system embodiment,
Low layer exception throws module installation, at the low layer of top layer, refers to the Service layer being separately positioned on Dao layer and being arranged on higher than Dao layer; In the low layer exception throws module of Service layer, the exception come is thrown for the low layer exception throws module at Dao layer directly to throw to and belong to the top layer of last layer;
Top layer abnormality processing module installation is at key-course or execution level.
In said system embodiment,
Low layer exception throws module belongs to definition this layer of exception of subclass or lower floor except dishing out to upper strata in engineering project performance history and throws except the exception come, this layer of also dishing out to upper strata or lower floor throw the exception of being dished out by third party's program come;
Top layer abnormality processing module, except concentrating the exception of the definition subclass of catching low layer upthrow by exception catching unit, also concentrates the exception of being dished out by third party's program of catching low layer upthrow; By the exception that exception processing unit process is caught, then convert the exception of process to corresponding information by information conversion unit.

Claims (6)

1. the method for abnormality processing in the exploitation of Java engineering project, is characterized in that, comprising:
The operationally abnormal subclass of define program and service exception subclass in exception class;
Low layer in engineering project performance history under top layer is all dished out to upper strata and is belonged to the exception of described program exception subclass and described service exception subclass;
Concentrated the exception belonging to described program exception subclass and described service exception subclass of catching described low layer upthrow by described top layer, and convert corresponding information to after processing the exception of catching.
2. in accordance with the method for claim 1, it is characterized in that,
Low layer under described top layer is respectively the Business treatment that data are looked for object layer and looked for object layer higher than described data, and described Business treatment is looked for object layer for described data and thrown the exception come and directly throw to and belong to the described top layer of last layer;
Described top layer refers to key-course or execution level.
3., according to the method described in claim 1 or 2, it is characterized in that,
Except the exception that described low layer belongs to described program exception subclass and described service exception subclass except dishing out to upper strata, the exception of being dished out by third party's program of also dishing out to upper strata;
Described top layer is caught except the exception belonging to described program exception subclass and described service exception subclass of described low layer upthrow except concentrating, also catch the exception of being dished out by third party's program of described low layer upthrow, and convert corresponding information to after processing the exception of catching.
4. the system of abnormality processing in the exploitation of Java engineering project, is characterized in that, comprise the abnormal subclass definitions module, low layer exception throws module and the top layer abnormality processing module that connect successively, wherein:
Abnormal subclass definitions module, for the abnormal subclass of define program and service exception subclass in operationally exception class;
Low layer exception throws module, is arranged on the low layer of top layer, and this layer of exception belonging to program exception subclass and service exception subclass for dishing out to upper strata in engineering project performance history or lower floor throw the exception come;
Top layer abnormality processing module, for being concentrated the exception belonging to program exception subclass and service exception subclass of catching low layer upthrow by exception catching unit, by the exception that exception processing unit process is caught, then convert the exception of process to corresponding information by information conversion unit.
5., according to system according to claim 4, it is characterized in that,
Described low layer exception throws module installation, at the low layer of top layer, refers to that being separately positioned on data looks for object layer and be arranged on the Business treatment of looking for object layer higher than described data; In the low layer exception throws module of described Business treatment, the exception come is thrown for the low layer exception throws module of looking for object layer in described data directly to throw to and belong to the described top layer of last layer;
Described top layer abnormality processing module installation is at key-course or execution level.
6., according to the system described in claim 4 or 5, it is characterized in that,
Described low layer exception throws module is thrown except the exception come except dish out to upper strata in engineering project performance history this layer of exception belonging to program exception subclass and service exception subclass or lower floor, this layer of also dishing out to upper strata or lower floor throw the exception of being dished out by third party's program come;
Described top layer abnormality processing module except concentrated by exception catching unit catch described low layer upthrow the exception belonging to program exception subclass and service exception subclass except, also concentrate and catch the described exception of being dished out by third party's program of described low layer upthrow; By the exception that exception processing unit process is caught, then convert the exception of process to corresponding information by information conversion unit.
CN201410645204.0A 2014-11-12 2014-11-12 Method and system for exception handling in Java engineering project development Pending CN104331367A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410645204.0A CN104331367A (en) 2014-11-12 2014-11-12 Method and system for exception handling in Java engineering project development

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410645204.0A CN104331367A (en) 2014-11-12 2014-11-12 Method and system for exception handling in Java engineering project development

Publications (1)

Publication Number Publication Date
CN104331367A true CN104331367A (en) 2015-02-04

Family

ID=52406099

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410645204.0A Pending CN104331367A (en) 2014-11-12 2014-11-12 Method and system for exception handling in Java engineering project development

Country Status (1)

Country Link
CN (1) CN104331367A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105528260A (en) * 2015-12-09 2016-04-27 中国建设银行股份有限公司 Error code output method and device
CN105550059A (en) * 2015-12-09 2016-05-04 中国建设银行股份有限公司 Error code conversion method and equipment
CN106020836A (en) * 2016-05-27 2016-10-12 浪潮(北京)电子信息产业有限公司 Exception handling method and device for lower layer exception inheriting upper layer exception
CN106055465A (en) * 2016-05-31 2016-10-26 广东能龙教育股份有限公司 Client error abnormal information statistical method
CN106095914A (en) * 2016-06-07 2016-11-09 四川长虹电器股份有限公司 Unified error blog management method
CN107807884A (en) * 2017-11-07 2018-03-16 国云科技股份有限公司 A kind of method of modularization management error code
CN108345542A (en) * 2018-02-28 2018-07-31 腾讯科技(深圳)有限公司 Abnormality eliminating method and device in a kind of application program
CN108415727A (en) * 2017-11-30 2018-08-17 平安科技(深圳)有限公司 Abnormality eliminating method and storage medium in electronic device, Web application and developments
CN109376025A (en) * 2018-09-03 2019-02-22 平安普惠企业管理有限公司 Abnormality eliminating method, device, computer equipment and storage medium
CN109408232A (en) * 2018-10-17 2019-03-01 山东易通发展集团有限公司 A kind of modularization bus calling execution system based on transaction flow
CN112328497A (en) * 2020-11-27 2021-02-05 四川长虹电器股份有限公司 Java exception handling method
CN113010401A (en) * 2019-12-19 2021-06-22 广州凡科互联网科技股份有限公司 SSM system-based exception capture processing method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102385508A (en) * 2010-09-03 2012-03-21 金蝶软件(中国)有限公司 Exception handling method and device and software system
CN102521117A (en) * 2011-10-27 2012-06-27 北京航空航天大学 Java exception propagation static structure extraction method
CN103488534A (en) * 2013-09-23 2014-01-01 浪潮集团山东通用软件有限公司 Method for enabling business logic layer to feed back control information to presentation layer
US20140122935A1 (en) * 2012-10-30 2014-05-01 International Business Machines Corporation Diagnosing a Problem of a Software Product Running in a Cloud Environment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102385508A (en) * 2010-09-03 2012-03-21 金蝶软件(中国)有限公司 Exception handling method and device and software system
CN102521117A (en) * 2011-10-27 2012-06-27 北京航空航天大学 Java exception propagation static structure extraction method
US20140122935A1 (en) * 2012-10-30 2014-05-01 International Business Machines Corporation Diagnosing a Problem of a Software Product Running in a Cloud Environment
CN103488534A (en) * 2013-09-23 2014-01-01 浪潮集团山东通用软件有限公司 Method for enabling business logic layer to feed back control information to presentation layer

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105550059A (en) * 2015-12-09 2016-05-04 中国建设银行股份有限公司 Error code conversion method and equipment
CN105528260A (en) * 2015-12-09 2016-04-27 中国建设银行股份有限公司 Error code output method and device
CN106020836A (en) * 2016-05-27 2016-10-12 浪潮(北京)电子信息产业有限公司 Exception handling method and device for lower layer exception inheriting upper layer exception
CN106020836B (en) * 2016-05-27 2019-07-26 浪潮(北京)电子信息产业有限公司 The abnormality eliminating method and device of upper layer exception are inherited extremely by a kind of lower layer
CN106055465A (en) * 2016-05-31 2016-10-26 广东能龙教育股份有限公司 Client error abnormal information statistical method
CN106095914A (en) * 2016-06-07 2016-11-09 四川长虹电器股份有限公司 Unified error blog management method
CN107807884A (en) * 2017-11-07 2018-03-16 国云科技股份有限公司 A kind of method of modularization management error code
WO2019104894A1 (en) * 2017-11-30 2019-06-06 平安科技(深圳)有限公司 Electronic device, exception handling method in web application development, and storage medium
CN108415727A (en) * 2017-11-30 2018-08-17 平安科技(深圳)有限公司 Abnormality eliminating method and storage medium in electronic device, Web application and developments
CN108345542A (en) * 2018-02-28 2018-07-31 腾讯科技(深圳)有限公司 Abnormality eliminating method and device in a kind of application program
CN108345542B (en) * 2018-02-28 2021-01-29 腾讯科技(深圳)有限公司 Method and device for processing exception in application program
CN109376025A (en) * 2018-09-03 2019-02-22 平安普惠企业管理有限公司 Abnormality eliminating method, device, computer equipment and storage medium
CN109408232A (en) * 2018-10-17 2019-03-01 山东易通发展集团有限公司 A kind of modularization bus calling execution system based on transaction flow
CN113010401A (en) * 2019-12-19 2021-06-22 广州凡科互联网科技股份有限公司 SSM system-based exception capture processing method
CN112328497A (en) * 2020-11-27 2021-02-05 四川长虹电器股份有限公司 Java exception handling method

Similar Documents

Publication Publication Date Title
CN104331367A (en) Method and system for exception handling in Java engineering project development
CN107526624B (en) Intelligent contract execution engine based on Java virtual machine
CN103559118B (en) A kind of method for auditing safely based on AOP and annotating information system
Rubira et al. Exception handling in the development of dependable component‐based systems
CN105676808B (en) A kind of implementation method of industrial control system logic break point debugging function
US20100218169A1 (en) Contract failure behavior with escalation policy
CN112183782B (en) Fault work order processing method and equipment
CN109871290B (en) Call stack tracking method and device applied to Java and storage medium
US20100131745A1 (en) Exceptional events
CN103279421B (en) A kind of program exception propagation model building method based on data origin technology
CN105095329A (en) Method for checking population data
CN108681446B (en) Crowd-sourced climate algorithm management system and method based on component service
CN110705974B (en) Complete intelligent contract form specification implementation method
CN101048738A (en) Method, operational system and computing unit for executing a computer program
CN105164642A (en) Operating system support for contracts
CN101794243A (en) Method for strengthening java application program by utilizing operation system structuralization exception processing
Lee et al. Npex: Repairing java null pointer exceptions without tests
CN105243023A (en) Method for detecting errors generated during parallel running
CN102262537B (en) Method for processing abnormities of execution engine working in mixed model
CN113760491A (en) Task scheduling system, method, equipment and storage medium
CN105677540A (en) Method for remotely monitoring running state of remote unreachable software system
CN102707956B (en) Probabilistic method is returned results for the treatment of trigger
CN104111838A (en) Tramcar integration dispatching linkage logic implementation method
CN104699472A (en) Method for solving contradiction between frequent changes in business process and software maintenance by adopting rule engine
CN107145422B (en) Software fault alarm monitoring method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20150204

RJ01 Rejection of invention patent application after publication