IP Library Granted Patent US 9,052,980
Granted Patent B2
US 9,052,980 · App. 13/772,040 · Granted Jun 9, 2015

Exception based quality assessment

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,052,980
App. No.
13/772,040
Granted
Jun 9, 2015
Kind
B2
Abstract

The embodiments may include an apparatus for measuring code quality using exceptions. The apparatus may include a runtime collector configured to intercept exceptions generated by an application, and collect exception information for each exception, during runtime of the application, based on instrumentation code included within the application. The apparatus may include a collection module configured to store the intercepted exceptions and corresponding exception information in a memory unit, an exception analyzer configured to analyze the intercepted exceptions based on the collected exception information stored in the memory unit, and a report generator configured to generate at least one report based on the analysis. The at least one report may provide an indication of code quality of the application.

Claims (51)

1. A method for measuring code quality using exceptions, the method comprising:

intercepting, by at least one processor, exceptions generated by an application, and collecting, by the at least one processor, exception information for each exception, during runtime of the application, based on instrumentation code included within the application, each exception representing a potential error that occurred during runtime of the application, the exceptions including caught exceptions and uncaught exceptions;

storing, by the at least one processor, the intercepted exceptions and corresponding exception information in a memory unit;

analyzing, by the at least one processor, the intercepted exceptions based on the collected exception information stored in the memory unit including determining a total number of intercepted exceptions, a number of uncaught exceptions, and a number of unique locations that produced the exceptions;

calculating, by the at least one processor, a score indicating a level of code quality of the application with a weighted scoring algorithm inputted with the total number of intercepted exceptions, the number of uncaught exceptions, and the number of unique locations that produced the exceptions, wherein the calculating the score with the weighted scoring algorithm includes applying weights to values of the collected exception information; and

generating, by the at least one processor, an exception-based report providing the score, and a listing of the exceptions by type, the listing of the exceptions also indicating whether or not an exception was uncaught and number of times each exception type was thrown.

2. The method of claim 1 , further comprising:

injecting, by the at least one processor, the instrumentation code within a base class associated with the exceptions;

monitoring, by the at least one processor, all constructors of the base class; and

collecting, by the at least one processor, one or more arguments of a monitored constructor as the monitored constructor is called during the runtime of the application.

3. The method of claim 1 , wherein the exception information includes a fault line number indicating at least one code line that produced a corresponding exception, class information indicating a class that produced the corresponding exception, type information indicating a type of the corresponding exception, a stack trace of the application that produced the corresponding exception, a cause of the corresponding exception, and a message associated with the corresponding exception.

4. The method of claim 1 , further comprising:

generating, by the at least one processor, an exception-based report that characterizes the exceptions by locations within the application that produced each exception.

5. An apparatus for measuring code quality using exceptions, the apparatus comprising:

at least one processor;

a non-transitory computer-readable storage medium including instructions executable by the at least one processor, the instructions configured to implement,

a runtime collector configured to intercept exceptions generated by an application, and collect exception information for each exception, during runtime of the application, based on instrumentation code included within the application, each exception representing a potential error that occurred during runtime of the application, the exceptions including caught exception and uncaught exceptions;

a collection module configured to store the intercepted exceptions and corresponding exception information in a memory unit;

an exception analyzer configured to analyze the intercepted exceptions based on the collected exception information stored in the memory unit including determining a total number of intercepted exceptions, a number of caught or uncaught exceptions, and a number of unique locations that produced the exceptions;

the exception analyzer configured to calculate a score indicating a level of code quality of the application based on the total number of intercepted exceptions, the number of caught or uncaught exceptions, and the number of unique locations that produced the exceptions, wherein the exception analyzer is configured to calculate the score according to a weighted scoring algorithm that applies weights to values of the collected exception information; and

a report generator configured to provide the score and generate an exception-based report based on the analysis, the exception-based report providing an indication of code quality of the application, the exception-based report listing the exceptions by type.

6. The apparatus of claim 5 , further comprising:

an instrumentation engine configured to inject the instrumentation code within a base class associated with the exceptions such that constructors of the base class are monitored during runtime of the application.

7. The apparatus of claim 6 , wherein the base class associated with the exceptions includes java.lang.throwable class.

8. The apparatus of claim 6 , wherein the runtime collector is further configured to monitor the constructors of the base class, and collect one or more arguments of a monitored constructor as the monitored constructor is called during the runtime of the application.

9. The apparatus of claim 5 , wherein the exception information includes a fault line number indicating at least one code line that produced a corresponding exception, class information indicating a class that produced the corresponding exception, type information indicating a type of the corresponding exception, a stack trace of the application that produced the corresponding exception, a cause of the corresponding exception, and a message associated with the corresponding exception.

10. The apparatus of claim 5 , wherein the exception analyzer includes:

a categorizer configured to derive a type of each exception, and a location within the application that produced each exception based on the exception information,

the categorizer configured to categorize the intercepted exceptions according to the type.

11. The apparatus of claim 5 ,

wherein the exception analyzer is further configured to derive an exception type count indicating a number of times each exception type was thrown, a class exception count indicating a number of times a particular class or method produced an exception, and a faulting location count indicating a number of times a particular location produced an exception, based on the exception information,

wherein the report generator is further configured to provide the exception type count, the class exception count, and the faulting location count.

12. The apparatus of claim 5 , wherein the exception analyzer is configured to calculate the score according to the weighted scoring algorithm that applies the weights to total number of exceptions, different exception types, the number of uncaught exceptions, and the number of unique locations that produced the exceptions.

13. The apparatus of claim 5 , wherein the exception analyzer is configured to assign a ranking value to each exception type, and the exception analyzer is configured to adjust the score using the ranking values.

14. The apparatus of claim 5 , wherein the memory unit is a hash array.

15. A non-transitory computer-readable medium storing instructions that when executed cause at least one processor to measure code quality using exceptions, the instructions comprising instructions to:

intercept exceptions generated by an application, and collect exception information for each exception, during runtime of the application, based on instrumentation code included within the application, each exception representing a potential error that occurred during runtime of the application, the exceptions including caught exceptions and uncaught exceptions, the uncaught exceptions being exceptions not caught in a try/catch block;

store the intercepted exceptions and corresponding exception information in a memory unit;

analyze the intercepted exceptions based on the collected exception information stored in the memory unit including determine a total number of intercepted exceptions and a number of uncaught exceptions;

calculate a score indicating a level of code quality of the application based on a weighted scoring algorithm inputted with the total number of intercepted exceptions and the number of uncaught exceptions such that weights are applied to the exception information;

generate an exception-based report based on the analysis;

compare the exception-based report and the score with an exception-based report and score for a previous version of the application; and

provide a comparison report indicating whether the level of code quality has increased or decreased from the previous version of the application.

16. The non-transitory computer-readable medium of claim 15 , wherein the instructions include instructions to determine if an exception count is increasing or decreasing between a current version and the previous version, and whether there are new exception types and new locations in the current version.

17. The non-transitory computer-readable medium of claim 15 , wherein the exception-based report provides a portion of a stack trace of an exception, the portion of the stack trace indicating whether there are any threads terminated by the exception and whether the exception is located in a location under control of a developer of the application.

18. The non-transitory computer-readable medium of claim 15 , wherein the instructions to calculate the score include instructions to:

determine a first penalty value when the total number of exceptions is above a first threshold level;

determine a second penalty value when the number of uncaught exceptions is above a second threshold level; and

adjust the score based on the first penalty value and the second penalty value.

19. The non-transitory computer-readable medium of claim 18 , wherein the instructions to calculate the score include instructions to:

calculate the score with the weighted scoring algorithm including applying the weights to the total number of exceptions, different types of exceptions, the number of uncaught exceptions, and number of unique locations that produced the exceptions.

Assignments (15)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 7, 2025
From: BMC SOFTWARE, INC.
To: BMC HELIX, INC.
Reel/Frame 070442/0197 →
GRANT OF FIRST LIEN SECURITY INTEREST IN PATENT RIGHTS Recorded Nov 13, 2024
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: GOLDMAN SACHS BANK USA, AS COLLATERAL AGENT
Reel/Frame 069352/0628 →
GRANT OF SECOND LIEN SECURITY INTEREST IN PATENT RIGHTS Recorded Nov 13, 2024
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: GOLDMAN SACHS BANK USA, AS COLLATERAL AGENT
Reel/Frame 069352/0568 →
RELEASE OF SECURITY INTEREST IN PATENTS PREVIOUSLY RECORDED AT REEL/FRAME (052854/0139) Recorded Aug 6, 2024
From: THE BANK OF NEW YORK MELLON TRUST COMPANY, N.A., AS COLLATERAL AGENT
To: BMC SOFTWARE, INC.; BLADELOGIC, INC.
Reel/Frame 068339/0617 →
RELEASE OF SECURITY INTEREST IN PATENTS PREVIOUSLY RECORDED AT REEL/FRAME (052844/0646) Recorded Aug 6, 2024
From: THE BANK OF NEW YORK MELLON TRUST COMPANY, N.A., AS COLLATERAL AGENT
To: BMC SOFTWARE, INC.; BLADELOGIC, INC.
Reel/Frame 068339/0408 →
OMNIBUS ASSIGNMENT OF SECURITY INTERESTS IN PATENT COLLATERAL Recorded Mar 4, 2024
From: CREDIT SUISSE AG, CAYMAN ISLANDS BRANCH, AS RESIGNING COLLATERAL AGENT
To: GOLDMAN SACHS BANK USA, AS SUCCESSOR COLLATERAL AGENT
Reel/Frame 066729/0889 →
TERMINATION AND RELEASE OF SECURITY INTEREST IN PATENTS Recorded Feb 1, 2024
From: ALTER DOMUS (US) LLC
To: BMC SOFTWARE, INC.; BLADELOGIC, INC.
Reel/Frame 066567/0283 →
GRANT OF SECOND LIEN SECURITY INTEREST IN PATENT RIGHTS Recorded Sep 30, 2021
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: ALTER DOMUS (US) LLC
Reel/Frame 057683/0582 →
SECURITY INTEREST Recorded Jun 4, 2020
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: THE BANK OF NEW YORK MELLON TRUST COMPANY, N.A., AS COLLATERAL AGENT
Reel/Frame 052844/0646 →
SECURITY INTEREST Recorded Jun 4, 2020
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: THE BANK OF NEW YORK MELLON TRUST COMPANY, N.A., AS COLLATERAL AGENT
Reel/Frame 052854/0139 →
RELEASE OF PATENTS Recorded Oct 5, 2018
From: CREDIT SUISSE AG, CAYMAN ISLANDS BRANCH
To: BMC SOFTWARE, INC.; BLADELOGIC, INC.; BMC ACQUISITION L.L.C.
Reel/Frame 047198/0468 →
SECURITY INTEREST Recorded Oct 2, 2018
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: CREDIT SUISSE, AG, CAYMAN ISLANDS BRANCH, AS COLLATERAL AGENT
Reel/Frame 047185/0744 →
SECURITY INTEREST Recorded Jul 27, 2017
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: CREDIT SUISSE AG, CAYMAN ISLANDS BRANCH, AS COLLATERAL AGENT
Reel/Frame 043351/0189 →
SECURITY AGREEMENT Recorded Sep 11, 2013
From: BMC SOFTWARE, INC.; BLADELOGIC, INC.
To: CREDIT SUISSE AG, CAYMAN ISLANDS BRANCH, AS COLLATERAL AGENT
Reel/Frame 031204/0225 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 18, 2013
From: HULICK, WALTER T.
To: BMC SOFTWARE, INC.
Reel/Frame 030030/0845 →