CN113467815A - Application repair method and device for hot update, terminal equipment and storage medium - Google Patents

Application repair method and device for hot update, terminal equipment and storage medium Download PDF

Info

Publication number
CN113467815A
CN113467815A CN202110735348.5A CN202110735348A CN113467815A CN 113467815 A CN113467815 A CN 113467815A CN 202110735348 A CN202110735348 A CN 202110735348A CN 113467815 A CN113467815 A CN 113467815A
Authority
CN
China
Prior art keywords
java
class
application
configuration
repaired
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.)
Granted
Application number
CN202110735348.5A
Other languages
Chinese (zh)
Other versions
CN113467815B (en
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.)
Ping An E Wallet Electronic Commerce Co Ltd
Original Assignee
Ping An E Wallet Electronic Commerce 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 Ping An E Wallet Electronic Commerce Co Ltd filed Critical Ping An E Wallet Electronic Commerce Co Ltd
Priority to CN202110735348.5A priority Critical patent/CN113467815B/en
Priority claimed from CN202110735348.5A external-priority patent/CN113467815B/en
Publication of CN113467815A publication Critical patent/CN113467815A/en
Application granted granted Critical
Publication of CN113467815B publication Critical patent/CN113467815B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application is applicable to the technical field of software updating, and particularly relates to an application repair method and device for hot updating, terminal equipment and a storage medium. The method analyzes the obtained repaired Java configuration class to obtain an updated Java class, and generates an interceptor in the problem Java class according to the updated Java class, so that Java methods in the problem Java class can be intercepted and the Java methods in the updated Java class are called, the problems in any Java application can be repaired, a local method of the Java application is not relied on, a real-time solution can be provided for the instant problems of the Java application, the method is wide in applicable scene, and strong in applicability.

Description

Application repair method and device for hot update, terminal equipment and storage medium
Technical Field
The present application belongs to the field of software update technologies, and in particular, to a method and an apparatus for repairing a hot-update application, a terminal device, and a storage medium.
Background
At present, the mode of writing or modifying the configuration file is adopted to complete the reissuing of the Java application and the calling of the local method, so that the updating and hot deployment of the Java application can be quickly realized, a series of work such as programming, compiling, debugging and publishing can be avoided, and the updating time is reduced. However, the above method is only suitable for dynamically encapsulating the local method in the Java application, cannot provide a new Java method and a real-time solution, and has limited applicable scenarios.
Disclosure of Invention
In view of this, embodiments of the present application provide a method and an apparatus for repairing a hot-update application, a terminal device, and a storage medium, so as to solve the problem that a hot-update method in the prior art is limited in applicable scenarios.
In a first aspect, an embodiment of the present application provides an application repair method for hot update, where the application repair method includes:
acquiring a repair Java configuration class which is a code corresponding to a problem occurring in a repair Java application;
analyzing the repaired Java configuration class to obtain an updated Java class, wherein the updated Java class comprises a Java method for solving the problems of the Java application;
according to the repaired Java configuration class, positioning a problem Java class corresponding to the problem of the Java application;
and generating an interceptor in the problem Java class according to the updated Java class, wherein the interceptor is used for intercepting the Java method in the problem Java class and calling the Java method in the updated Java class.
In a second aspect, an embodiment of the present application provides a hot-update application repair device, including:
the system comprises a configuration class acquisition module, a configuration class recovery module and a Java configuration class recovery module, wherein the configuration class acquisition module is used for acquiring a recovery Java configuration class which is a code corresponding to a problem occurring in recovery Java application;
the update class generation module is used for analyzing the repaired Java configuration class to obtain an update Java class, and the update Java class comprises a Java method for solving the problem of the Java application;
the problem class positioning module is used for positioning a problem Java class corresponding to a problem of the Java application according to the repaired Java configuration class;
and the interceptor generating module is used for generating an interceptor in the problem Java class according to the updated Java class, and the interceptor is used for intercepting the Java method in the problem Java class and calling the Java method in the updated Java class.
In a third aspect, an embodiment of the present application provides a terminal device, where the terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor, when executing the computer program, implements the application repair method according to the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the application repairing method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the application repairing method according to the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: according to the method and the device, the obtained repaired Java configuration class is analyzed to obtain the updated Java class, and the interceptor is generated in the problem Java class according to the updated Java class, so that Java methods in the problem Java class can be intercepted and the Java methods in the updated Java class are called, the problems in any Java application can be repaired, a local method of the Java application is not relied on, a real-time solution can be provided for the instant problems of the Java application, the method and the device are wide in applicable scene, and high in applicability.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart illustrating a hot-update application repair method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of an application repair method for hot update according to a second embodiment of the present application;
fig. 3 is a schematic structural diagram of a hot-update application repair apparatus according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The terminal device in the embodiment of the present application may be a palm top computer, a desktop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud terminal device, a Personal Digital Assistant (PDA), and the like, and the specific type of the terminal device is not limited in this embodiment of the present application.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
In order to explain the technical means of the present application, the following description will be given by way of specific examples.
Referring to fig. 1, a schematic flowchart of an application repair method for hot update provided in an embodiment of the present application is shown, where the application repair method is applied to a terminal device, and the terminal device runs at least one Java application. As shown in fig. 1, the application repair method may include the steps of:
step S101, obtaining a repair Java configuration class.
The recovery Java configuration class is a code corresponding to a problem occurring in a Java application running in the recovery terminal device. The problem of the Java application may refer to a problem occurring when a certain Java class is executed during the running process of the Java application, and the problem may refer to a failure or an unexpected execution result. Repairing a Java configuration class is a solution to the problem that includes a solution to solve or repair the problem.
The nature of the repaired Java configuration class is code, the code can comprise a Java programming configuration class, compared with an xml configuration class, the Java programming configuration class has a clearer structure, higher readability and time saving, but the Java programming configuration class needs to write configuration parameters when the configuration parameters of the Java application are modified. The configuration class configured by the xml provides the xml document, the use is simple, the expansion is easy, the configuration parameters of the Java application do not need to be edited, but the reading and the analysis of the configuration files in the configuration class configured by the xml take longer time, the contents of the xml configuration files are overstaffed, and the management is inconvenient. Therefore, the problems of the Java application can be repaired more efficiently and clearly by adopting the Java configuration class.
The terminal equipment runs at least one Java application, and the Java application can be used for providing services for users, and when the services have problems, the problems of the Java application are shown, and the Java application needs to be repaired. The terminal equipment is connected with a configuration center, the configuration center is provided with a configuration interface for configuration operation of developers, the developers can configure and repair the Java configuration class of the problem according to the problem of the service in the configuration interface, and the Java configuration class is sent to the terminal equipment, so that the problem of the Java application can be repaired.
When the fixed Java Configuration class is created by using Java programming Configuration, annotation Configuration needs to be added to the class name of the Configuration class to inform Spring that it is a Configuration class, which acts like an xml file in xml Configuration. When creating a Java configuration class, an annotation PropertySource is also required to be added to the class name, and a read path of the properties file (i.e. the configuration file) is specified, so that the read path can be used for acquiring parameters in the properties file. When the Java configuration class is created, a Java application configuration attribute Value is required to be obtained, annotation Value is added to an attribute variable, and parameters in a configuration file are obtained through $ { } expression. Dependence injection is required when the Java configuration class is created, namely, a Bean annotation or FactoryBean annotation is added to the solution in the repaired Java configuration class, so that the repaired Java configuration class is convenient to analyze subsequently, and the solution is obtained.
In one embodiment, a developer may send a repair Java configuration class to a terminal device with a specified network address through a configuration center, thereby triggering repair work of an application in the terminal device. Specifically, the configuration center has a distribution characteristic, and meets the distribution requirement by using the characteristic of Redis publish-subscribe.
The terminal device periodically acquires the configuration class of the Java application, detects whether the configuration class of the Java application changes, and executes step S102 when the configuration class of the Java application changes.
And step S102, analyzing the repaired Java configuration class to obtain an updated Java class.
Wherein updating the Java class includes a Java method that solves a problem that the Java application presents. The Java method is a method that can be executed in a Java virtual machine, and has the same contents as a solution method in the fixed Java configuration class.
As can be seen from the above, repairing a Java configuration class includes configuration parameters, solutions, and the like for Java applications, and in order to run the configuration parameters and solutions in the Java applications, the Java configuration class needs to be analyzed, so as to obtain the contents of the configuration parameters, the solutions, and the like in the Java configuration class.
If the solution in the Java configuration class is a Java method, analyzing and repairing the Java configuration class can obtain the Java method as an updated Java class. If the solution in the Java configuration class is not a Java method that can be executed in the Java virtual machine, the solution needs to be converted into a Java method that can be executed in the Java virtual machine, i.e., the updated Java class is obtained.
Optionally, analyzing the repaired Java configuration class to obtain the updated Java class includes:
extracting and repairing a solution in the Java configuration class;
and writing the solution into a structural statement of the Java class to obtain an updated Java class.
The extracting may refer to finding a corresponding solution from the properties file of the repair Java configuration class, and stripping the solution from the entire repair Java configuration class. The extracted solution needs to be converted into a Java method to be executed by the Java virtual machine, and thus, the solution needs to be packaged into a Java class having a Java format (i.e., an updated Java class) so that the Java virtual machine can execute the updated Java class.
Optionally, writing the solution into a structural statement of the Java class, and obtaining the updated Java class includes:
creating a container in spring according to the annotation Configuration of the fixed Java Configuration class;
injecting solutions in repairing Java configuration classes into containers
And obtaining the updated Java class.
The analyzing and repairing the Java configuration class can be realized by using spring, the spring analysis has the advantages of high speed, high analysis precision and the like, and after the solution is extracted, the analyzing and repairing the Java configuration class further comprises the following processes: according to the annotation Configuration in the repaired Java Configuration class, the spring can know that the Configuration class is a Configuration class, a container is further created in the spring, a solution in the repaired Java Configuration class is injected into the container, and the Configuration attribute and the parameter in the repaired Java Configuration class are obtained.
Class files, which are Java methods that can be executed by a Java virtual machine by generating solutions through a bytecode mechanism. The byte code mechanism can be used for converting a solution in a recovery Java configuration class into a byte code file with the extension of class, the byte code file can be executed in a Java virtual machine, and Java methods are filled into Java classes by using a structure file, so that the Java classes are formed by the Java files and can be further applied to Java application.
According to the method, a byte-hot plug-in developed based on Java is arranged in a Java application providing services in the terminal equipment, and if the repaired Java configuration class changes the original Java configuration class, the byte-hot plug-in triggers analysis of a new Java configuration class when detecting that the Java configuration class changes, namely analyzes the repaired Java configuration class.
Optionally, before parsing the Java configuration class, the application repair method further includes:
detecting whether the Java application comprises a repaired Java configuration class;
correspondingly, analyzing and repairing the Java configuration class to obtain an updated Java class includes:
and if the Java application is detected not to include the repaired Java configuration class, analyzing the repaired Java configuration class to obtain an updated Java class.
The detecting whether the Java configuration class is changed may be comparing a current Java configuration class in the Java application with the obtained repair Java configuration class, where the current Java configuration class is the same as the repair Java configuration class, indicating that the Java application includes the repair Java configuration class, and at this time, stopping repairing without analyzing the repair Java configuration class.
The current Java configuration class is different from the repair Java configuration class, which indicates that the Java application does not include the repair Java configuration class, that is, the Java configuration class in the Java application is changed, and at this time, the repair Java configuration class needs to be analyzed to repair the Java application.
And step S103, positioning a problem Java class corresponding to the problem of the Java application according to the repaired Java configuration class.
The terminal equipment directly positions the problem Java class corresponding to the problem of the Java application. For example, the abnormal code position is located through the output statement, and for example, by using the jdb tool, when the program is run, the corresponding breakpoint is directly marked, and then debug work is performed, so that the problem Java class is determined.
Optionally, according to the repaired Java configuration class, locating a problem Java class corresponding to a problem occurring in the Java application includes:
according to the repaired Java configuration class, acquiring identification information of a problem Java class corresponding to a problem of the Java application;
and positioning a code line corresponding to the identification information from the code line of the Java application, and determining that the content included in the code line corresponding to the identification information is a problem Java class.
In an implementation mode, the terminal device can determine the file name of the Java file with the suffix according to information such as configuration parameters and the like acquired from the repaired Java configuration class, so that the problem Java class corresponding to the problem of the Java application can be located.
In one embodiment, when distributing and repairing the Java configuration class, the configuration center distributes the identification information of the corresponding problem Java class to the terminal device, and the terminal device locates the problem Java class according to the identification information acquired from the configuration center. For example, the distribution center sends the file name of the Java file of the problem Java class to the terminal equipment, and the terminal equipment can locate the problem Java class according to the file name of the Java file.
And step S104, generating an interceptor in the problem Java class according to the updated Java class.
The interceptor is used for intercepting the Java method in the problem Java class and calling and updating the Java method in the Java class.
The present application is based on the principle of spring-oriented profile Programming (AOP), wherein spring AOP may refer to a mechanism that provides additional code execution before and after executing a service, and the profile Programming includes profile (Aspect), connection point (join), notification (Advice), point of entry (Pointcut), and Introduction (Introduction).
In spring, the AOP principle can be embodied in the form of an interceptor in a notification manner, and the interceptor is essentially a reflection mechanism and is mainly used for intercepting one Java method to execute another Java method, that is, intercepting a Java method in a problem Java class and calling an updated Java class.
Because the notification (advertisement) in the spring is further divided into a front notification, a rear notification, a final notification, a surround notification, an exception notification, and the like, the interceptors may be divided into an interceptor executed before the Java method, an interceptor executed after the Java method, an exception interceptor, and the like, where the front interceptor class of the Java method needs to implement a methodbedbarrier advertisement interface, and the back interceptor class of the Java method needs to implement an after returningadvertisement interface, and the exception interceptor class needs to implement a thrawsadview interface.
In the application, the Java application is executed in the Java virtual machine, and the Java class under the update pointed by the interceptor can be executed in the Java virtual machine only in the form of byte codes, so that the calling of the Java method in the update Java class is realized.
According to the method and the device for repairing the Java application, the obtained repaired Java configuration class is analyzed to obtain the updated Java class, and the interceptor is generated in the problem Java class according to the updated Java class, so that Java methods in the problem Java class can be intercepted and the Java methods in the updated Java class are called, the problems in any Java application can be repaired, a local method of the Java application is not relied on, a real-time solution can be provided for the instant problems of the Java application, the applicable scene is wide, and the applicability is strong.
Referring to fig. 2, which is a schematic flowchart of an application repair method for hot update according to a second embodiment of the present application, as shown in fig. 2, the application repair method may include the following steps:
step S201, obtaining a repair Java configuration class.
Step S202, resolving the repaired Java configuration class to obtain an updated Java class.
Step S203, positioning a problem Java class corresponding to the problem of the Java application.
And step S204, generating an interceptor in the problem Java class according to the updated Java class.
The content types of steps S201 to S204 are the same as those of steps S101 to S104, and reference may be made to the description of steps S101 to S104, which is not repeated herein.
Step S205, in the process of executing the Java application, an execution result of the interceptor is obtained.
Wherein, in order to verify the result of the repair, the execution result of the interceptor in executing the Java application needs to be obtained. And the terminal equipment triggers and executes the Java application after detecting that the Java application is repaired, and acquires a result code (namely an execution result) executed by the interceptor according to the position of the interceptor in the process of executing the Java application.
In step S206, if the execution result includes the class name corresponding to the fixed Java configuration class, it is determined that the problem occurring in the Java application is solved.
And analyzing a result code executed by the interceptor, wherein the code comprises a class name corresponding to the repaired Java configuration class, which indicates that the interceptor is effective, can intercept the problem Java class, and execute the updated Java class. For example, the execution code includes the bearer name corresponding to the repair Java configuration, that is, the bearer name of the update Java class, and it is determined that the interceptor can intercept the problem Java class and execute the update Java class corresponding to the bearer name.
According to the method and the device, whether the hot-update Java application repairing method is successfully repaired can be verified through automatic execution of the Java application and acquisition of the execution result of the interceptor and analysis of the execution result, the application repairing method is supervised, and the problems of use errors and the like caused by unrepaired Java applications can be solved by timely feeding back the repairing result.
Corresponding to the application repairing method in the foregoing embodiment, fig. 3 shows a block diagram of a hot-update application repairing apparatus provided in the third embodiment of the present application, where the application repairing apparatus is applied to a terminal device, and the terminal device is connected to N data transmission interfaces, where N is an integer greater than zero. For convenience of explanation, only portions related to the embodiments of the present application are shown.
Referring to fig. 3, the application repair apparatus includes:
a configuration class obtaining module 31, configured to obtain a repair Java configuration class, where the repair Java configuration class is a code corresponding to a problem occurring in a repair Java application;
an update class generation module 32, configured to parse and repair the Java configuration class to obtain an update Java class, where the update Java class includes a Java method that solves a problem occurring in Java application;
the problem class positioning module 33 is used for positioning a problem Java class corresponding to a problem occurring in the Java application according to the repaired Java configuration class;
and the interceptor generating module 34 is configured to generate an interceptor in the problem Java class according to the updated Java class, where the interceptor is configured to intercept Java methods in the problem Java class and call the Java methods in the updated Java class.
Optionally, the application repair apparatus further includes:
the detection module is used for detecting whether the Java application comprises a repaired Java configuration class or not before the Java configuration class is analyzed;
accordingly, the update class generation module 32 is specifically configured to:
and if the Java application is detected not to include the repaired Java configuration class, analyzing the repaired Java configuration class to obtain an updated Java class.
Optionally, the update class generating module 32 includes:
the extraction unit is used for extracting and repairing a solution in the Java configuration class;
and the conversion unit is used for converting the solution into the updated Java class.
Optionally, the extracting unit is specifically configured to:
creating a container in spring according to the annotation Configuration of the fixed Java Configuration class;
injecting a solution in the repair Java configuration class into the container;
the solution is retrieved from the container.
Optionally, the problem class positioning module 33 includes:
the Java application management system comprises an identification information acquisition unit, a management unit and a management unit, wherein the identification information acquisition unit is used for acquiring identification information of a problem Java class corresponding to a problem occurring in a Java application;
and the positioning unit is used for positioning the code position of the problem Java class in the Java application according to the identification information.
Optionally, the application repair apparatus further includes:
the result acquisition module is used for acquiring the execution result of the interceptor in the process of executing the Java application;
and the determining module is used for determining that the problem of the Java application is solved if the execution result contains the class name corresponding to the repaired Java configuration class.
It should be noted that, because the contents of information interaction, execution process, and the like between the modules are based on the same concept as that of the embodiment of the method of the present application, specific functions and technical effects thereof may be specifically referred to a part of the embodiment of the method, and details are not described here.
Fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present application. As shown in fig. 4, the terminal device 4 of this embodiment includes: at least one processor 40 (only one shown in fig. 4), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, the steps in any of the various application repair method embodiments described above being implemented when the computer program 42 is executed by the processor 40.
The terminal device 4 may include, but is not limited to, a processor 40, a memory 41. Those skilled in the art will appreciate that fig. 4 is merely an example of the terminal device 4, and does not constitute a limitation of the terminal device 4, and may include more or less components than those shown, or combine some components, or different components, such as an input-output device, a network access device, and the like.
The Processor 40 may be a CPU, and the Processor 40 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may in some embodiments be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4. The memory 41 may be an external storage device of the terminal device 4 in other embodiments, such as a plug-in hard disk provided on the terminal device 4, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 41 may also include both an internal storage unit of the terminal device 4 and an external storage device. The memory 41 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of a computer program. The memory 41 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules, so as to perform all or part of the functions described above. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the above-mentioned apparatus may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method of the embodiments described above can be implemented by a computer program, which can be stored in a computer readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code, recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution media. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
When the computer program product runs on the terminal device, the steps in the method embodiments can be implemented when the terminal device executes the computer program product.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, a module or a unit may be divided into only one logical function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. An application repair method for hot updates, the application repair method comprising:
acquiring a repair Java configuration class which is a code corresponding to a problem occurring in a repair Java application;
analyzing the repaired Java configuration class to obtain an updated Java class, wherein the updated Java class comprises a Java method for solving the problems of the Java application;
according to the repaired Java configuration class, positioning a problem Java class corresponding to the problem of the Java application;
and generating an interceptor in the problem Java class according to the updated Java class, wherein the interceptor is used for intercepting the Java method in the problem Java class and calling the Java method in the updated Java class.
2. The application repair method of claim 1, wherein prior to said parsing the Java configuration class, the application repair method further comprises:
detecting whether the Java application comprises the repair Java configuration class;
correspondingly, the analyzing the repair Java configuration class to obtain an updated Java class includes:
and if the Java application is detected not to include the repaired Java configuration class, analyzing the repaired Java configuration class to obtain an updated Java class.
3. The application repair method according to claim 1, wherein the parsing the repair Java configuration class to obtain an updated Java class comprises:
extracting a solution in the repaired Java configuration class;
and writing the solution into a structural statement of the Java class to obtain the updated Java class.
4. The application repair method according to claim 3, wherein writing the solution into a structural statement of a Java class to obtain the updated Java class comprises:
creating a container in spring according to the annotation Configuration of the repaired Java Configuration class;
and injecting the solution in the repaired Java configuration class into the container to obtain the updated Java class.
5. The method according to claim 1, wherein the locating, according to the repair Java configuration class, a problem Java class corresponding to a problem occurring in the Java application comprises:
according to the repaired Java configuration class, acquiring identification information of a problem Java class corresponding to a problem occurring in the Java application;
and positioning the code line corresponding to the identification information from the code line of the Java application, and determining that the content included in the code line corresponding to the identification information is the problem Java class.
6. The application repair method according to any one of claims 1 to 5, characterized in that the application repair method further comprises:
acquiring an execution result of the interceptor in the process of executing the Java application;
and if the execution result contains the class name corresponding to the repaired Java configuration class, determining that the problem of the Java application is solved.
7. A hot-update application repair device, the application repair device comprising:
the system comprises a configuration class acquisition module, a configuration class recovery module and a Java configuration class recovery module, wherein the configuration class acquisition module is used for acquiring a recovery Java configuration class which is a code corresponding to a problem occurring in recovery Java application;
the update class generation module is used for analyzing the repaired Java configuration class to obtain an update Java class, and the update Java class comprises a Java method for solving the problem of the Java application;
the problem class positioning module is used for positioning a problem Java class corresponding to a problem of the Java application according to the repaired Java configuration class;
and the interceptor generating module is used for generating an interceptor in the problem Java class according to the updated Java class, and the interceptor is used for intercepting the Java method in the problem Java class and calling the Java method in the updated Java class.
8. The application repair device according to claim 7, further comprising:
a detection module, configured to detect whether the Java application includes the repair Java configuration class before the Java configuration class is parsed;
correspondingly, the update class generation module is specifically configured to:
and if the Java application is detected not to include the repaired Java configuration class, analyzing the repaired Java configuration class to obtain an updated Java class.
9. A terminal device, characterized in that the terminal device comprises a processor, a memory and a computer program stored in the memory and executable on the processor, the processor implementing the application repair method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the application repair method according to any one of claims 1 to 6.
CN202110735348.5A 2021-06-30 Application repairing method and device for hot update, terminal equipment and storage medium Active CN113467815B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110735348.5A CN113467815B (en) 2021-06-30 Application repairing method and device for hot update, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110735348.5A CN113467815B (en) 2021-06-30 Application repairing method and device for hot update, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113467815A true CN113467815A (en) 2021-10-01
CN113467815B CN113467815B (en) 2024-09-27

Family

ID=

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115576589A (en) * 2022-12-08 2023-01-06 平安银行股份有限公司 Program hot updating method, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2701061A1 (en) * 2012-08-24 2014-02-26 CA, Inc. Method of updating or rollbacking dynamically a Java Agent by instrumenting its bytecode
CN109445807A (en) * 2017-08-28 2019-03-08 腾讯科技(深圳)有限公司 Realize the method, apparatus and computer readable storage medium of application program update
CN110221857A (en) * 2019-06-18 2019-09-10 北京字节跳动网络技术有限公司 The problem of application program restorative procedure, device, electronic equipment and storage medium
CN110471786A (en) * 2019-08-20 2019-11-19 网易(杭州)网络有限公司 Online hot restorative procedure, device, equipment and computer readable storage medium
CN111506904A (en) * 2020-04-21 2020-08-07 北京同邦卓益科技有限公司 Method and device for online vulnerability repair

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2701061A1 (en) * 2012-08-24 2014-02-26 CA, Inc. Method of updating or rollbacking dynamically a Java Agent by instrumenting its bytecode
CN109445807A (en) * 2017-08-28 2019-03-08 腾讯科技(深圳)有限公司 Realize the method, apparatus and computer readable storage medium of application program update
CN110221857A (en) * 2019-06-18 2019-09-10 北京字节跳动网络技术有限公司 The problem of application program restorative procedure, device, electronic equipment and storage medium
CN110471786A (en) * 2019-08-20 2019-11-19 网易(杭州)网络有限公司 Online hot restorative procedure, device, equipment and computer readable storage medium
CN111506904A (en) * 2020-04-21 2020-08-07 北京同邦卓益科技有限公司 Method and device for online vulnerability repair

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
鸽一门: "Android热修复(二):以DexClassLoader类加载原理编写demo实现类替换修复", pages 2 - 8, Retrieved from the Internet <URL:https://blog.csdn.net/ITermeng/article/details/79362042> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115576589A (en) * 2022-12-08 2023-01-06 平安银行股份有限公司 Program hot updating method, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US20070271617A1 (en) Vulnerability check program, vulnerability check apparatus, and vulnerability check method
CN111158741A (en) Method and device for monitoring change of dependency relationship of business module on third-party class library
CN114895935A (en) Method and device for flashing vehicle ECU, electronic equipment and storage medium
CN114356779A (en) Programming language debugging method and device and terminal equipment
KR102165747B1 (en) Lightweight crash report based debugging method considering security
US11263115B2 (en) Problem diagnosis technique of memory corruption based on regular expression generated during application compiling
CN112445706A (en) Program abnormal code acquisition method and device, electronic equipment and storage medium
CN107451050B (en) Function acquisition method and device and server
CN113467815A (en) Application repair method and device for hot update, terminal equipment and storage medium
CN110795358B (en) Code instrumentation detection method, apparatus, device and medium
CN113419738A (en) Interface document generation method and device and interface management equipment
CN112114870A (en) Method and device for packaging codes, terminal equipment and storage medium
CN112925523A (en) Object comparison method, device, equipment and computer readable medium
CN110908869A (en) Application program data monitoring method, device, equipment and storage medium
CN112527265A (en) Method for automatically injecting logs and computer equipment
CN110597707A (en) Memory out-of-range fault detection method and terminal equipment
CN117688564B (en) Detection method, device and storage medium for intelligent contract event log
CN111198812B (en) Application fault detection method, application fault detection device and terminal equipment
CN117992359B (en) Method and device for observing service software and electronic equipment
CN114780952B (en) Detection method, system and storage medium for sensitive application call scene
CN112162776B (en) Dependency relationship acquisition method and device
CN115686532A (en) Processing method and device for bean data exception, computer equipment and storage medium
CN114385159A (en) File processing method and device, electronic equipment and computer readable storage medium
CN118227486A (en) Release version debugging method, release version debugging device, electronic device and storage medium
CN118535217A (en) Patch file generation method, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination