Method, system, medium, device and terminal for realizing abnormal information configuration

By dynamically analyzing code features to create exception information, the problem of non-unique exception information definitions and difficulty in hard-coding adjustments in existing technologies is solved. This enables the configuration of exception information, improving system maintenance efficiency and exception location speed.

CN116048995BActive Publication Date: 2026-03-20DIGITAL CHINA FINANCIAL SOFTWARE LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-12
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

The lack of a systematic exception information definition and management mechanism in the existing business system leads to non-unique exception code definitions, increases maintenance costs, and easily causes code conflicts when multiple developments are carried out in parallel. Furthermore, hard-coded exception codes require synchronous code adjustments, making it difficult to quickly identify the key issues.

Method used

By acquiring code characteristics, exception information can be dynamically analyzed and created using exception utility classes. Based on code characteristics, there is no need for hard coding, default exception definitions are supported, exception information can be dynamically locked, and no exception code needs to be specified when creating exception information.

Benefits of technology

It enables configurable exception information, reduces development complexity, avoids exception code conflicts and confusion, improves work efficiency, and supports quick location of exception causes and correction of system exceptions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116048995B_ABST
    Figure CN116048995B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of exception systematization, and discloses a method, system, medium, equipment and terminal for realizing exception information configuration, code coordinates are acquired, exception definitions are acquired according to the code coordinates, it is judged whether there is an exception definition, if there is an exception definition, exception information is created, if there is no exception definition, default exception definitions are acquired and exception information is created, and then exception information configuration is realized. The application reduces the complexity of creating exceptions, so that a developer only needs to throw out exceptions conforming to specifications and convenient for later maintenance through an exception tool, without worrying about whether the exception codes conflict and whether the use is chaotic. An exception tool class of the application quickly maps exception definition information according to exception definition elements, and creates corresponding exceptions according to exception types, wherein the stack frame technology of JVM is used to quickly lock the code line number, which is used as one of the elements of the exception definition, so as to solve the problems of traditional definition exception code conflict and chaos.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of abnormal systematization, and particularly relates to a method, system, medium, equipment and terminal for realizing abnormal information configuration. BACKGROUND

[0002] At present, the most common abnormal information maintenance mode in a business system is to complete the maintenance through an exception code definition configuration file, and the abnormal information is maintained in the configuration file by a developer, and the exception is established in a specific business scenario.

[0003] Firstly, there is no systematic abnormal definition and management mechanism, and the definition of the exception code cannot guarantee global uniqueness, which leads to the fact that the developer can directly throw a general exception without defining the exception code, thereby increasing the system maintenance cost and failing to quickly lock the problem key according to the abnormal feedback. Moreover, the exception code is defined in the configuration file, and in the case of multiple parallel developments, code conflicts are easily caused, thereby reducing the work efficiency.

[0004] Moreover, the exception code is hard-coded in the code, and when the exception code is adjusted, the code needs to be adjusted synchronously. Especially after the system is put into operation, if the exception code is found to be incorrect, it cannot be adjusted in time.

[0005] Based on the above situation, how to constrain the development to establish effective exceptions, avoid the adjustment difficulty caused by hard coding, and avoid too many conflicts to reduce the work efficiency has become a big pain point of the system exception establishment.

[0006] Through the above analysis, the problems and defects of the prior art are as follows:

[0007] (1) The abnormal information maintenance mode in the existing business system has no systematic abnormal definition and management mechanism, and the definition of the exception code cannot guarantee global uniqueness, which leads to the fact that the developer can directly throw a general exception without defining the exception code, thereby increasing the system maintenance cost and failing to quickly lock the problem key according to the abnormal feedback.

[0008] (2) The abnormal information maintenance mode in the existing business system defines the exception code in the configuration file, and in the case of multiple parallel developments, code conflicts are easily caused, thereby reducing the work efficiency.

[0009] (3) The exception code is hard-coded in the code, and when the exception code is adjusted, the code needs to be adjusted synchronously. Especially after the system is put into operation, if the exception code is found to be incorrect, it cannot be adjusted in time. SUMMARY

[0010] In view of the problems in the prior art, the present application provides a method, system, medium, equipment and terminal for realizing abnormal information configuration, and particularly relates to a method, system, medium, equipment and terminal for realizing abnormal information configuration based on code features.

[0011] The present application is achieved, a method for realizing abnormal information configuration, the method for realizing abnormal information configuration comprises the following steps:

[0012] Step one, obtaining code coordinates;

[0013] Step two, obtaining exception definition according to code coordinates;

[0014] Step three, judge whether there is exception definition, if there is exception definition, create exception information;

[0015] Step four, if there is no exception definition, obtain default exception definition and create exception information.

[0016] Further, the obtaining code coordinates in step one is to obtain the current code characteristics, and the code characteristics include class, method name, code line and file name; wherein, the obtaining method of the current code characteristics specifically includes:

[0017] The static analysis method is used for the current code file, and the disassembly analysis is carried out by using the decompilation tool, and the sensitive point of the current code file is determined; the sensitive point includes sensitive function call, array sensitive operation and pointer sensitive operation; wherein, the sensitive function includes library function or API function, the array sensitive operation includes access or assignment to array element, and the pointer sensitive operation includes access or assignment to pointer;

[0018] The sensitive point of the current code file is optimized, and the initial sensitive variable of each sensitive point is obtained; the data flow of the initial sensitive variable is tracked, other sensitive variables are obtained, the executable path set related to the semantic of the sensitive variable is obtained, and the dynamic analysis node is allocated to each path;

[0019] Through the dynamic analysis tool, the automatic single-step debugging method is used for dynamic analysis, so that the program is executed according to the control flow sequence of the executable path obtained by static analysis, and the code API call association is obtained;

[0020] The dynamic analysis node of the current code is input into the target learning model, and the gradient value on each channel in the convolution layer of the target learning model is calculated; the heat map data of the current code file is calculated according to the executable path set and the gradient value, and the contribution score of the to-be-processed code file to the entire code file is determined;

[0021] The obtained executable path set is arranged in the order in the source code file, and the API call association is analyzed according to the contribution score of the to-be-processed code file to the entire code file, and the current code characteristics containing the source code sensitive point feature information are determined;

[0022] The abnormal information is created by calling an exception creation method of an exception tool class to obtain an exception definition according to a current code feature and create the abnormal information.

[0023] Further, the contribution score of the to-be-processed code file to the entire code file is calculated by using the following formula:

[0024]

[0025] In the formula, seq i represents the ith to-be-processed code, I d represents whether the dth to-be-processed code file in the D code files contains seq i , wherein I d = 1 indicates that the dth to-be-processed code file contains seq i , and I d = 0 indicates that the dth to-be-processed code file does not contain seq i ; freq d represents the number of times that seq i appears in the dth to-be-processed code file, s i represents the contribution score of the ith to-be-processed code seq i .

[0026] Further, in step two, the exception creation method is called by the exception tool class to obtain an exception definition according to a current code feature and create abnormal information, which specifically includes:

[0027] Obtaining the code file to be detected and monitoring the code file to be detected, determining abnormal code when the code runs abnormally; performing lexical analysis on the abnormal code in the code file, detecting abnormal lexemes in the abnormal code, and constructing a singly linked list based on the abnormal lexemes;

[0028] Performing syntax and semantic analysis on the abnormal code based on the singly linked list to determine abnormal syntax and abnormal semantics in the abnormal code; calling an exception creation method by an exception tool class to obtain an exception definition of the current code according to the current code feature, the abnormal lexemes, the abnormal syntax, and the abnormal semantics, and create abnormal information;

[0029] The exception tool class is configured in an exception definition configuration file according to the abnormal code to obtain corresponding abnormal information and throw an exception without specifying the abnormal code; the exception definition is obtained by the code feature, and the default exception definition is supported to cope with unknown abnormal scenarios and create abnormal information.

[0030] Further, the exception definition in step two includes:

[0031] The class name indicates the class name of the created exception;

[0032] Method name, indicating the method name of creating the exception;

[0033] Code line, indicating the code line number of creating the exception;

[0034] Exception type, indicating the type of creating the exception;

[0035] Exception code, indicating the corresponding business code of the exception information;

[0036] Exception message, indicating the specific description of the exception, used to support the exception parameter transmission.

[0037] Further, the code line is obtained from the stack frame by the stack frame technology of the JVM; the exception type includes the parameter class exception, the business data exception, the database exception and the framework processing exception;

[0038] The exception code rules are as follows: ① the first two digits indicate the system module, including the accounting engine; ② the middle two blocks indicate the function block, including the journal generation in the accounting engine; ③ the last two digits indicate the function point, including the obtaining journal template in the journal generation; if it is not necessary to be refined to the function point, the last two digits are set to a specific value;

[0039] The exception parameter adopts the array form, and the placeholder is supported in the exception message configuration, and the parameter data is obtained from the exception parameter according to the subscript by the exception tool class.

[0040] Another object of the present application is to provide an implementation exception information configuration system applying the implementation exception information configuration method, the implementation exception information configuration system comprises:

[0041] Code feature extraction module, used to obtain the current code feature by using the static analysis method;

[0042] Exception creation module, used to call the exception creation method by the exception tool class;

[0043] Exception definition module, used to obtain the exception definition according to the current code feature by using the exception creation method;

[0044] Exception information creation module, used to judge whether the exception definition exists, if the exception definition exists, the exception information is created; if the exception definition does not exist, the default exception definition is obtained and the exception information is created.

[0045] Another object of the present application is to provide a computer device, the computer device comprises a memory and a processor, the memory stores a computer program, when the computer program is executed by the processor, the processor executes the steps of the implementation exception information configuration method.

[0046] Another object of the present application is to provide a computer readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method for realizing abnormal information configuration.

[0047] Another object of the present application is to provide an information data processing terminal for realizing the system for realizing abnormal information configuration.

[0048] In combination with the above technical solutions and the technical problems solved, the technical solutions of the present application have the following advantages and positive effects:

[0049] First, in view of the technical problems existing in the prior art and the difficulty in solving the problems, the technical solutions of the present application are closely combined with the results and data in the research and development process, and the technical problems solved by the technical solutions are analyzed in detail and profoundly. Some creative technical effects brought about after solving the problems are described as follows:

[0050] The present application provides a method for realizing abnormal information configuration, which is based on code features to complete abnormal information configuration. The present application proposes abnormal information configuration without hard coding, and developers do not need to worry about how to define abnormal codes. Only according to code features, the abnormal definition and the proposed scheme of the business system in any scenario are completed. The present application aims to establish a perfect abnormal system and integrate it into daily research and development work, and enable developers to consciously comply with the abnormal specification, so as to avoid the phenomenon of abnormal information confusion and conflict.

[0051] (1) Abnormal definition: In order to facilitate developers to quickly and efficiently create exceptions, a new abnormal definition mechanism is indispensable. This mechanism avoids developers to manually define abnormal codes and hard code them. The exception tool dynamically locks the abnormal information and creates an exception through the elements in the abnormal definition.

[0052] (2) Abnormal type: Different abnormal types create their own abnormal base class. The exception tool creates an exception according to the abnormal type, which provides strong help for abnormal reason analysis.

[0053] (3) Abnormal code | abnormal message: According to the business system, the abnormal code definition is specified. When there is an abnormality, the business scenario of the abnormality is first locked through the abnormal code, and the abnormal reason is located according to the abnormal message, which will be more rapid and efficient.

[0054] The application provides an exception tool class, through which a developer can directly call a method created by an exception in any exception scene, and the method acquires an exception definition according to current code features and creates exception information. As to the exception tool class, the previous mode of specifying an exception code, acquiring corresponding exception information in an exception definition configuration file according to the exception code, and throwing an exception is abandoned. The biggest change of the new exception tool class is that the exception code does not need to be specified, which avoids the risk of conflict and confusion caused by manually defining the exception code. The exception tool class acquires an exception definition through code features (class, method name, code line, file name), supports default exception definition, and finally creates exception information to cope with unknown exception scenes.

[0055] Secondly, the technical scheme is regarded as a whole or from the perspective of a product, the technical effects and advantages of the technical scheme to be protected by the application are described as follows.

[0056] The application aims to reduce the complexity of creating an exception, so that a developer can quickly throw an exception conforming to a specification and convenient for later maintenance through an exception tool without worrying about whether the exception code is in conflict or is used in confusion. The exception tool class quickly maps exception definition information according to exception definition elements and creates a corresponding exception according to an exception type, wherein the stack frame technology of JVM is used to quickly lock a code line, which is used as one of the exception definition elements, and the problem of conflict and confusion of the traditional exception code definition is solved.

[0057] The exception information configuration processing of the application completely gets rid of the traditional exception processing mechanism, reduces the workload of exception definition, and improves work efficiency; the reduction of hard coding also provides convenience for code maintenance work, including that the exception information found after the system is put into operation is incorrect, which can also be quickly corrected through exception definition configuration. BRIEF DESCRIPTION OF DRAWINGS

[0058] In order to more clearly illustrate the technical scheme of the embodiments of the application, the drawings needed to be used in the embodiments of the application will be briefly introduced as follows. Obviously, the drawings described below are only some embodiments of the application, and other drawings can also be obtained according to these drawings without creative labor for those skilled in the art.

[0059] Figure 1 is a method flowchart for realizing exception information configuration provided by the embodiments of the application;

[0060] Figure 2 is a method principle diagram for realizing exception information configuration provided by the embodiments of the application;

[0061] Figure 3 is a schematic diagram of code coordinates and exception definition mapping provided by the embodiments of the application. Detailed Implementation

[0062] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0063] To address the problems existing in the prior art, the present invention provides a method, system, medium, device, and terminal for configuring abnormal information. The present invention will be described in detail below with reference to the accompanying drawings.

[0064] I. Explanatory and Illustrative Embodiments. To enable those skilled in the art to fully understand how the present invention is specifically implemented, this section provides an explanatory and illustrative description of the embodiments described in the claims.

[0065] like Figure 1 and Figure 2 As shown, the method for implementing exception information configuration provided in this embodiment of the invention includes the following steps:

[0066] S101, obtain code coordinates;

[0067] S102, Obtain the exception definition based on code coordinates;

[0068] S103, Determine if an exception definition exists; if an exception definition exists, create exception information.

[0069] S104 If no exception is defined, the default exception definition is obtained and exception information is created.

[0070] The step S101 provided in this embodiment of the invention involves obtaining the current code features, which include class, method name, line of code, and file name.

[0071] The specific methods for obtaining the current code features include:

[0072] Static analysis is used on the current code file, and disassembly analysis is performed using decompilation tools to identify sensitive points in the current code file. Sensitive points include sensitive function calls, array sensitive operations, and pointer sensitive operations. Among them, sensitive functions include library functions or API functions, array sensitive operations include accessing or assigning values ​​to array elements, and pointer sensitive operations include accessing or assigning values ​​to pointers.

[0073] The system optimizes sensitive points in the current code file to obtain initial sensitive variables for each sensitive point; it tracks the data flow of the initial sensitive variables to obtain other sensitive variables, obtains a set of executable paths related to the semantics of the sensitive variables, and assigns dynamic analysis nodes to each path.

[0074] The dynamic analysis tool is used to perform dynamic analysis by using an automatic single-step debugging method, so that the program is executed in the control flow sequence of the executable path obtained by static analysis, and the code API call correlation is obtained.

[0075] The dynamic analysis node of the current code is input into the target learning model, and the gradient value on each channel in the convolution layer of the target learning model is calculated; the heat map data of the current code file is calculated according to the executable path set and the gradient value, and the contribution score of the code file to be processed to the entire code file is determined;

[0076] The obtained executable path set is arranged in the order in the source code file, and the API call correlation is analyzed according to the contribution score of the code file to be processed to the entire code file to determine the current code feature containing the source code sensitive point feature information.

[0077] The exception information is created by calling an exception creation method of an exception tool class according to the current code feature to obtain an exception definition and create exception information.

[0078] The contribution score of the code file to be processed to the entire code file is calculated by the following formula in the embodiment of the application:

[0079]

[0080] In the formula, seq i represents the i-th code to be processed, I d represents whether the d-th code file to be processed in the D code files contains seq i , wherein I d = 1, the d-th code file to be processed contains seq i , I d = 0, the d-th code file to be processed does not contain seq i ; freq d represents the number of times that seq i appears in the d-th code file to be processed, s i represents the contribution score corresponding to the i-th code to be processed seq i .

[0081] In step S102 provided by the embodiment of the application, the exception information is created by calling an exception creation method of an exception tool class according to the current code feature to obtain an exception definition and create exception information, and specifically includes:

[0082] The code file to be detected is obtained, and the code file to be detected is monitored when the code runs abnormally to determine the abnormal code; the abnormal code in the code file is subjected to lexical analysis, the abnormal lexical in the abnormal code is detected, and a one-way linked list is constructed based on the abnormal lexical;

[0083] The abnormal code is analyzed in syntax and semantics based on a single-linked list to determine abnormal syntax and abnormal semantics in the abnormal code; an abnormal creation method is called through an abnormal tool class to obtain abnormal definition of the current code and create abnormal information according to current code features, abnormal lexicon, abnormal syntax and abnormal semantics;

[0084] The abnormal tool class is configured according to the abnormal code through an abnormal definition configuration file to obtain corresponding abnormal information and throw an exception without specifying the abnormal code; abnormal definition is obtained through code features, and default abnormal definition is supported to cope with unknown abnormal scenarios to create abnormal information.

[0085] Regarding abnormal definition, the application proposes the following elements:

[0086] Class name: class name of the created abnormality;

[0087] Method name: method name of the created abnormality;

[0088] Code line: code line of the created abnormality;

[0089] Abnormal type: type of the created abnormality, such as parameter class abnormality (which can be further subdivided), business data abnormality, database abnormality, framework processing abnormality, etc.

[0090] Abnormal code: corresponding business code of the abnormal information, and the rules are as follows:

[0091] ① The first two digits represent a system module, such as an accounting engine;

[0092] ② The middle two digits represent a function block, such as entry generation in the accounting engine;

[0093] ③ The last two digits represent a function point, such as obtaining an entry template in entry generation; if it is not necessary to be refined to a function point, the last two digits can be set to a specific value, such as 00;

[0094] Abnormal message: specific description of the abnormality, which needs to support abnormal parameter transmission, and the abnormal parameters are in an array form, and placeholders are supported in abnormal message configuration to obtain parameter data from the abnormal parameters according to the subscript by the abnormal tool class.

[0095] As shown in the following table: Figure 3 According to the above elements, a developer maintains an abnormal definition table, and the system dynamically creates abnormal information as needed. Regarding the code line, the stack frame technology of the JVM is used to obtain the code line from the stack frame.

[0096] The application aims to establish a perfect abnormal system and integrate it into daily research and development work, and enable developers to consciously comply with abnormal specifications without abnormal information confusion and conflict.

[0097] Abnormal definition: in order to facilitate the developer to create the exception quickly and efficiently, the new abnormal definition mechanism is indispensable, and the mechanism avoids the developer to define the exception code manually and to hard code it. The exception tool locks the exception information dynamically through the elements in the abnormal definition, and creates the exception.

[0098] Abnormal type: for different abnormal types, the respective abnormal base class is created, and the exception tool creates the exception according to the abnormal type, which provides strong help for the abnormal reason analysis.

[0099] Abnormal code|Abnormal message: according to the business system to standardize the abnormal code definition, when there is an exception, the business scene of the exception is locked through the abnormal code first, and the abnormal reason is located according to the abnormal message, which will be more rapid and efficient.

[0100] II. Application embodiment. In order to prove the creativity and technical value of the technical scheme of the application, this part is the application embodiment of the technical scheme of the claim on the specific product or related technology.

[0101] The method for realizing the configuration of the abnormal information provided by the application embodiment is applied to a system for realizing the configuration of the abnormal information, and the system comprises:

[0102] The code feature extraction module is used to acquire the current code feature by using a static analysis method.

[0103] The abnormal creation module is used to call an abnormal creation method through an exception tool class.

[0104] The abnormal definition module is used to acquire an abnormal definition according to the current code feature by using the abnormal creation method.

[0105] The abnormal information creation module is used to judge whether there is an abnormal definition, if there is an abnormal definition, the abnormal information is created, and if there is no abnormal definition, the default abnormal definition is acquired and the abnormal information is created.

[0106] The method for realizing the configuration of the abnormal information provided by the application embodiment is applied to a computer device, and the computer device comprises a memory and a processor, the memory stores a computer program, and the computer program is executed by the processor to enable the processor to execute the steps of the method for realizing the configuration of the abnormal information.

[0107] The method for realizing the configuration of the abnormal information provided by the application embodiment is applied to a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by the processor to enable the processor to execute the steps of the method for realizing the configuration of the abnormal information.

[0108] The system for realizing abnormal information configuration provided by the application embodiment is applied to an information data processing terminal, and the information data processing terminal is used to realize the system for realizing abnormal information configuration.

[0109] It should be noted that the embodiments of the present application can be realized by hardware, software or a combination of hardware and software. The hardware part can be realized by special logic; the software part can be stored in a memory and executed by a suitable instruction execution system, such as a microprocessor or a specially designed hardware. Those skilled in the art can understand that the above-mentioned devices and methods can be realized by computer executable instructions and / or included in processor control codes, for example, such codes are provided on a carrier medium, such as a magnetic disk, a CD or a DVD-ROM, a programmable memory, such as a read-only memory (firmware), or a data carrier, such as an optical or electronic signal carrier. The devices of the present application and their modules can be realized by hardware circuits, such as very large scale integrated circuits or gate arrays, semiconductors, such as logic chips, transistors, etc., or programmable hardware devices, such as field programmable gate arrays, programmable logic devices, etc., by software executed by various types of processors, or by a combination of the above-mentioned hardware circuits and software, such as firmware.

[0110] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any modification, equivalent replacement and improvement within the technical range disclosed by the present application, which is within the spirit and principle of the present application, should be covered within the protection scope of the present application.

Claims

1. A method for configuring exception information, characterized in that, The method for implementing exception information configuration includes the following steps: Step 1: Obtain the code coordinates; Step 2: Obtain the exception definition based on the code coordinates; Step 3: Determine if an exception definition exists. If an exception definition exists, create exception information. Step 4: If no exception is defined, obtain the default exception definition and create exception information; Step one, obtaining code coordinates, involves acquiring the current code characteristics, which include class, method name, line of code, and file name. Specifically, the methods for acquiring the current code characteristics include: Static analysis is used on the current code file, and disassembly analysis is performed using decompilation tools to identify sensitive points in the current code file. Sensitive points include sensitive function calls, array sensitive operations, and pointer sensitive operations. Among them, sensitive functions include library functions or API functions, array sensitive operations include accessing or assigning values ​​to array elements, and pointer sensitive operations include accessing or assigning values ​​to pointers. The system optimizes sensitive points in the current code file to obtain initial sensitive variables for each sensitive point; it tracks the data flow of the initial sensitive variables to obtain other sensitive variables, obtains a set of executable paths related to the semantics of the sensitive variables, and assigns dynamic analysis nodes to each path. Dynamic analysis tools are used to perform dynamic analysis using automatic single-step debugging methods, so that the program executes in the control flow order of the executable path obtained by static analysis, and obtains the code API call associations; Input the dynamic analysis node of the current code into the target learning model and calculate the gradient value on each channel of the convolutional layer of the target learning model; calculate the heatmap data of the current code file based on the set of executable paths and the gradient value, and determine the contribution score of the code file to be processed to the entire code file; The obtained set of executable paths is arranged in the order of the source code files, and the API call association is analyzed. The current code features containing source code sensitive point feature information are determined according to the contribution score of the code file to be processed to the entire code file. Creating exception information involves calling the exception creation method of the exception utility class to obtain the exception definition based on the characteristics of the current code and then creating the exception information. In step two, the exception creation method is called through the exception utility class to obtain the exception definition and create exception information based on the current code characteristics. Specifically, this includes: The code file to be tested is obtained and its execution is monitored. When the code execution is abnormal, the abnormal code is identified. Lexical analysis is performed on the abnormal code in the code file to detect abnormal lexical expressions in the abnormal code, and a singly linked list is constructed based on the abnormal lexical expressions. Syntactic and semantic analysis of the exception code is performed based on a singly linked list to determine the exception syntax and semantics in the exception code; the exception creation method is called through the exception utility class to obtain the exception definition of the current code and create exception information based on the current code characteristics, exception lexical, exception syntax and exception semantics. Among them, the exception utility class obtains the corresponding exception information from the exception definition configuration file based on the exception code and throws the exception without specifying the exception code; it obtains the exception definition through code characteristics, and also supports default exception definitions to deal with unknown exception scenarios and create exception information.

2. The method for configuring exception information as described in claim 1, characterized in that, The contribution score of the code file to be processed to the entire code file is calculated using the following formula: In the formula, seq i I represents the i-th code to be processed. d Indicates whether the d-th code file to be processed in D code files contains seq. i , among which, I d When = 1, the d-th unprocessed code file contains seq i I d When = 0, the d-th code file to be processed does not contain seq. i freq d Represents seq i The number of times it appears in the d-th unprocessed code file, s i This represents the i-th code segment to be processed (seq). i The corresponding contribution score.

3. The method for configuring exception information as described in claim 1, characterized in that, The exception definitions in step two include: The class name indicates the class name to which the exception belongs; Method name, indicating the name of the method to which the exception was created; Line of code indicates the number of lines of code that create the exception; Exception type indicates the type of exception being created; Exception codes represent the corresponding business logic codes for exception information; An exception message provides a detailed description of the exception and is used to support the passing of exception parameters.

4. The method for configuring exception information as described in claim 3, characterized in that, The line of code is obtained from the stack frame using JVM stack frame technology; exception types include parameter exceptions, business data exceptions, database exceptions, and framework processing exceptions. The exception code rules are as follows: ① The first two digits represent the system module, including the accounting engine; ② The middle two digits represent the function block, including the entry generation in the accounting engine; ③ The last two digits represent the function point, including obtaining the entry template in the entry generation. If it is not necessary to be refined to the function point, the last two digits are set to a specific value. The exception parameters are in array form, and placeholders can be configured when configuring the exception message. The exception utility class retrieves the parameter data from the exception parameters according to the index.

5. A system for implementing exception information configuration using the method for implementing exception information configuration as described in any one of claims 1 to 4, characterized in that, Systems that enable configuration of exception information include: The code feature extraction module is used to obtain the current code features using static analysis methods. The exception creation module is used to call exception creation methods through the exception utility class; The exception definition module is used to obtain exception definitions based on the characteristics of the current code using the exception creation method; The exception information creation module is used to determine whether an exception definition exists. If an exception definition exists, exception information is created; otherwise, the default exception definition is obtained and exception information is created.

6. A computer device, characterized in that, The computer device includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the method for implementing exception information configuration as described in any one of claims 1 to 4.

7. A computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method for implementing exception information configuration as described in any one of claims 1 to 4.

8. An information data processing terminal, characterized in that, The information data processing terminal is used to implement the system for configuring abnormal information as described in claim 5.

Citation Information

Patent Citations

  • Abnormal information reporting method and device, computer equipment and storage medium

    CN113961384A

  • NC code anomaly detection method and device, equipment and storage medium

    CN115481396A

  • Method and system for providing source code suggestion to a user in real-time

    US20170371629A1