This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

Difference between revisions of "Dead Code: Unused Method"

From OWASP
Jump to: navigation, search
Line 1: Line 1:
{{Template:Vulnerability}}
+
{{template:CandidateForDeletion}}
{{Template:Fortify}}
+
 
 +
#REDIRECT [[Failure to follow guideline/specification]]
 +
 
  
 
__TOC__
 
__TOC__
Line 8: Line 10:
 
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''
 
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''
  
 
[[Category:FIXME|This is the text from the old template. This needs to be rewritten using the new template.]]
 
  
  
Line 86: Line 86:
 
==References==
 
==References==
 
TBD
 
TBD
[[Category:FIXME|add links
 
 
In addition, one should classify vulnerability based on the following subcategories: Ex:<nowiki>[[Category:Error Handling Vulnerability]]</nowiki>
 
 
Availability Vulnerability
 
 
Authorization Vulnerability
 
 
Authentication Vulnerability
 
 
Concurrency Vulnerability
 
 
Configuration Vulnerability
 
 
Cryptographic Vulnerability
 
 
Encoding Vulnerability
 
 
Error Handling Vulnerability
 
 
Input Validation Vulnerability
 
 
Logging and Auditing Vulnerability
 
 
Session Management Vulnerability]]
 
 
__NOTOC__
 
 
 
[[Category:OWASP ASDR Project]]
 
[[Category:Code Quality Vulnerability]]
 
[[Category:Java]]
 
[[Category:Implementation]]
 
[[Category:Code Snippet]]
 
[[Category:Vulnerability]]
 

Revision as of 10:20, 14 February 2009

Template:CandidateForDeletion

#REDIRECT Failure to follow guideline/specification


ASDR Table of Contents

Last revision (mm/dd/yy): 02/14/2009


Description

This method is never called or is only called from other dead code.


Risk Factors

TBD

Examples

Example 1

In the following class, the method doWork() can never be called.

	public class Dead {
	  private void doWork() {
		System.out.println("doing work");
	  }
	  public static void main(String[] args) {
		System.out.println("running Dead");
	  }
	}

Example 2

In the following class, two private methods call each other, but since neither one is ever invoked from anywhere else, they are both dead code.

	public class DoubleDead {
	  private void doTweedledee() {
		doTweedledumb();
	  }
	  private void doTweedledumb() {
		doTweedledee();
	  }
	  public static void main(String[] args) {
		System.out.println("running DoubleDead");
	  }
	}

(In this case it is a good thing that the methods are dead: invoking either one would cause an infinite loop.)

Related Attacks


Related Vulnerabilities


Related Controls


Related Technical Impacts


References

TBD