SlideShare a Scribd company logo
1 of 14
OSS Java Analysis
What You Might Be Missing
Overview
• Open Source Static Analysis Options for Java
• Case Study: Analysis of Jenkins Project
• Detailed Findings
2 Copyright 2013, Coverity, Inc.
Consistent Use = More Maintainable Code
Numerous Static Analysis Options for Java
Copyright 2013, Coverity, Inc.3
Checkstyle
Defines and enforces coding standards
Finds common programming flaws
and duplicated code
Finds bugs
Finds coding errors, ensures proper
testing coverage and more
• Will you use it?
• Does it find issues that you care about? Does it fit into your team’s
workflow? Is it worth the effort?
• Is it actionable?
• Does it just find issues, or does it help you understand how and
where to fix them?
• Is it accurate?
• Will you waste significant time on false positives? Are results
consistent across builds?
• Is it integrated?
• Do you have to go out of your way to use it, or does it bring the
problems to you?
Key Considerations
Copyright 2013, Coverity, Inc.4
Case Study: Jenkins
Coverity Development Testing Platform and FindBugs
5 Copyright 2013, Coverity, Inc.
Background
• Analyzed Jenkins 1.496 core code using up-to-date
Coverity and FindBugs (as of Dec 2012)
• Both solutions focus on finding defects, have IDE and
command line interfaces
Copyright 2013, Coverity, Inc.6
FindBugs
• Often used automatically in Eclipse
• Extensible tool
• Management capabilities focused
on individual developers
Coverity Platform
• Most often run in Eclipse or via
automated build
• Extensible tool, open platform
• Sophisticated management
capabilities addressing the needs of
developers, teams & organizations
Little Overlap
7 Copyright 2013, Coverity, Inc.
Only 28 relevant issues found by
both solutions
Defect Summary (Real Bugs Only)
8
Type Coverity FindBugs Both
Resource leaks 86 12 13
Security problems 1 0 0
Concurrency problems 22 10 9
High Severity Subtotal 109 22 22
Coding Standards, Best
Practices, Other
88 605 6
Total Bugs 197 627 28
Coverity
FindBug
s
Impact Distribution
High Med-Low
Copyright 2013, Coverity, Inc.
Each solution found
unique issues (neither is
sufficient to replace the
other)
Here is a resource leak identified by FindBugs:
• Identifies the problem and general location
• But there’s no indication of the affected object/variable, the
relevant code path or events
• Developers need to figure it out on their own
• Not a big deal in this simple code
• Complex code will be a pain!
Example: FindBugs Resource Leak
Copyright 2013, Coverity, Inc.9
A leak might affect something on this line
Here is a leak identified by Coverity:
The object will continue to hold resources until the garbage collector
eventually finalizes it—which may never happen.
Example: Coverity Resource Leak
Copyright 2013, Coverity, Inc.10
“listener” allocated. Implements
Closeable, so it needs to be closed
“listener” used, but still needs to be closed
Leak: no longer
usable, and never closed
Example: Coverity Race Condition
11 Copyright 2013, Coverity, Inc.
This is an HTTP request handler
“o” is associated with session
Another thread may modify the session
Session attribute is deleted. The right one?
Erroneous code path identified
You may delete the wrong key! Good luck finding this manually!
Example: Coverity Null Dereference
Copyright 2013, Coverity, Inc.12
Passing null to function
Dereferenced two layers deep
You should check for null before or during the call to rebuild()
Conclusion
• Different analysis tools often find different (important and
complementary) issues
• Use multiple tools that find issues important to you
• Avoid tools that take too long to analyze, require too much
manual work or have too many false positives
13 Copyright 2013, Coverity, Inc.
Copyright 2013 Coverity, Inc.

More Related Content

What's hot

TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?
Dmitriy Nesteryuk
 

What's hot (20)

React performance
React performanceReact performance
React performance
 
Code Review for iOS
Code Review for iOSCode Review for iOS
Code Review for iOS
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
Code Review Matters and Manners
Code Review Matters and MannersCode Review Matters and Manners
Code Review Matters and Manners
 
Is Groovy better for testing than Java?
Is Groovy better for testing than Java?Is Groovy better for testing than Java?
Is Groovy better for testing than Java?
 
Code Review
Code ReviewCode Review
Code Review
 
TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?
 
@LinkingNote annotation in YATSPEC
@LinkingNote annotation in YATSPEC@LinkingNote annotation in YATSPEC
@LinkingNote annotation in YATSPEC
 
Your Tests are Lying to You - Improving your Testing by Testing What Really M...
Your Tests are Lying to You - Improving your Testing by Testing What Really M...Your Tests are Lying to You - Improving your Testing by Testing What Really M...
Your Tests are Lying to You - Improving your Testing by Testing What Really M...
 
Bug prediction based on your code history
Bug prediction based on your code historyBug prediction based on your code history
Bug prediction based on your code history
 
First steps in testing analytics: Does test code quality matter?
First steps in testing analytics: Does test code quality matter?First steps in testing analytics: Does test code quality matter?
First steps in testing analytics: Does test code quality matter?
 
PHP unit testing - good and bad practices
PHP unit testing - good and bad practicesPHP unit testing - good and bad practices
PHP unit testing - good and bad practices
 
Are Agile Projects Doomed to Half-Baked Design?
Are Agile Projects Doomed to Half-Baked Design?Are Agile Projects Doomed to Half-Baked Design?
Are Agile Projects Doomed to Half-Baked Design?
 
Google, quality and you
Google, quality and youGoogle, quality and you
Google, quality and you
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
How to get the most out of code reviews
How to get the most out of code reviewsHow to get the most out of code reviews
How to get the most out of code reviews
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Testing strategies for legacy code
Testing strategies for legacy codeTesting strategies for legacy code
Testing strategies for legacy code
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the culture
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 

Viewers also liked

14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya
14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya
14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya
Kary Adi
 
Reasons for foreign listings by South African junior mining and exploration c...
Reasons for foreign listings by South African junior mining and exploration c...Reasons for foreign listings by South African junior mining and exploration c...
Reasons for foreign listings by South African junior mining and exploration c...
Vicki Shaw
 

Viewers also liked (17)

Lectura taller virtual los dos gallos
Lectura taller virtual los dos gallosLectura taller virtual los dos gallos
Lectura taller virtual los dos gallos
 
Csup
CsupCsup
Csup
 
Goal Centre e-bulletin Feb 2015
Goal Centre e-bulletin Feb 2015Goal Centre e-bulletin Feb 2015
Goal Centre e-bulletin Feb 2015
 
BNI Lake Business Builders- LOZ Vice President report
BNI Lake Business Builders- LOZ Vice President reportBNI Lake Business Builders- LOZ Vice President report
BNI Lake Business Builders- LOZ Vice President report
 
Dynamic Wellness JourneyCare Goal setting and research
Dynamic Wellness JourneyCare Goal setting and researchDynamic Wellness JourneyCare Goal setting and research
Dynamic Wellness JourneyCare Goal setting and research
 
Unidad iii mantencion_de_personal
Unidad iii mantencion_de_personalUnidad iii mantencion_de_personal
Unidad iii mantencion_de_personal
 
Walmart
WalmartWalmart
Walmart
 
54 Tactics You Can Do Yourself to get REAL customers to follow you
54 Tactics You Can Do Yourself to get REAL customers to follow you54 Tactics You Can Do Yourself to get REAL customers to follow you
54 Tactics You Can Do Yourself to get REAL customers to follow you
 
Cover Diari de Girona
Cover Diari de GironaCover Diari de Girona
Cover Diari de Girona
 
14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya
14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya
14 kode-03-b5-strategi-pembelajaran-dan-pemilihannya
 
幸福創業計畫
幸福創業計畫幸福創業計畫
幸福創業計畫
 
I love free_nsta2010
I love free_nsta2010I love free_nsta2010
I love free_nsta2010
 
Reasons for foreign listings by South African junior mining and exploration c...
Reasons for foreign listings by South African junior mining and exploration c...Reasons for foreign listings by South African junior mining and exploration c...
Reasons for foreign listings by South African junior mining and exploration c...
 
Green Market Press December 2012
Green Market Press December 2012Green Market Press December 2012
Green Market Press December 2012
 
Dr. Bart Cammaerts - The Mediation of Dissensus
Dr. Bart Cammaerts - The Mediation of DissensusDr. Bart Cammaerts - The Mediation of Dissensus
Dr. Bart Cammaerts - The Mediation of Dissensus
 
Daniel Avidor - Deciphering the Viral Code – The Secrets of Redmatch
Daniel Avidor - Deciphering the Viral Code – The Secrets of RedmatchDaniel Avidor - Deciphering the Viral Code – The Secrets of Redmatch
Daniel Avidor - Deciphering the Viral Code – The Secrets of Redmatch
 
O medio mariño fichas (Candea 1994)
O medio mariño fichas (Candea 1994)O medio mariño fichas (Candea 1994)
O medio mariño fichas (Candea 1994)
 

Similar to OSS Java Analysis - What You Might Be Missing

Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@
Alex Borsuk
 
Annotated Bibliography .Guidelines Annotated Bibliograph.docx
Annotated Bibliography  .Guidelines Annotated Bibliograph.docxAnnotated Bibliography  .Guidelines Annotated Bibliograph.docx
Annotated Bibliography .Guidelines Annotated Bibliograph.docx
justine1simpson78276
 
Twelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btechTwelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btech
IIITA
 

Similar to OSS Java Analysis - What You Might Be Missing (20)

Code quality
Code quality Code quality
Code quality
 
Software testing
Software testingSoftware testing
Software testing
 
TestDrivenDeveloment
TestDrivenDevelomentTestDrivenDeveloment
TestDrivenDeveloment
 
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
 
Software testing
Software testingSoftware testing
Software testing
 
Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@
 
Annotated Bibliography .Guidelines Annotated Bibliograph.docx
Annotated Bibliography  .Guidelines Annotated Bibliograph.docxAnnotated Bibliography  .Guidelines Annotated Bibliograph.docx
Annotated Bibliography .Guidelines Annotated Bibliograph.docx
 
Improving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeImproving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis code
 
Topic production code
Topic production codeTopic production code
Topic production code
 
Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?
 
FutureOfTesting2008
FutureOfTesting2008FutureOfTesting2008
FutureOfTesting2008
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Twelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btechTwelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btech
 
Software Defects and SW Reliability Assessment
Software Defects and SW Reliability AssessmentSoftware Defects and SW Reliability Assessment
Software Defects and SW Reliability Assessment
 
DevOps - Boldly Go for Distro
DevOps - Boldly Go for DistroDevOps - Boldly Go for Distro
DevOps - Boldly Go for Distro
 
Agile principles and practices
Agile principles and practicesAgile principles and practices
Agile principles and practices
 
TDD on OSGi, in practice.
TDD on OSGi, in practice.TDD on OSGi, in practice.
TDD on OSGi, in practice.
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
 
Website qa
Website qaWebsite qa
Website qa
 
Maintaining Large Scale Julia Ecosystems
Maintaining Large Scale Julia EcosystemsMaintaining Large Scale Julia Ecosystems
Maintaining Large Scale Julia Ecosystems
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

OSS Java Analysis - What You Might Be Missing

  • 1. OSS Java Analysis What You Might Be Missing
  • 2. Overview • Open Source Static Analysis Options for Java • Case Study: Analysis of Jenkins Project • Detailed Findings 2 Copyright 2013, Coverity, Inc.
  • 3. Consistent Use = More Maintainable Code Numerous Static Analysis Options for Java Copyright 2013, Coverity, Inc.3 Checkstyle Defines and enforces coding standards Finds common programming flaws and duplicated code Finds bugs Finds coding errors, ensures proper testing coverage and more
  • 4. • Will you use it? • Does it find issues that you care about? Does it fit into your team’s workflow? Is it worth the effort? • Is it actionable? • Does it just find issues, or does it help you understand how and where to fix them? • Is it accurate? • Will you waste significant time on false positives? Are results consistent across builds? • Is it integrated? • Do you have to go out of your way to use it, or does it bring the problems to you? Key Considerations Copyright 2013, Coverity, Inc.4
  • 5. Case Study: Jenkins Coverity Development Testing Platform and FindBugs 5 Copyright 2013, Coverity, Inc.
  • 6. Background • Analyzed Jenkins 1.496 core code using up-to-date Coverity and FindBugs (as of Dec 2012) • Both solutions focus on finding defects, have IDE and command line interfaces Copyright 2013, Coverity, Inc.6 FindBugs • Often used automatically in Eclipse • Extensible tool • Management capabilities focused on individual developers Coverity Platform • Most often run in Eclipse or via automated build • Extensible tool, open platform • Sophisticated management capabilities addressing the needs of developers, teams & organizations
  • 7. Little Overlap 7 Copyright 2013, Coverity, Inc. Only 28 relevant issues found by both solutions
  • 8. Defect Summary (Real Bugs Only) 8 Type Coverity FindBugs Both Resource leaks 86 12 13 Security problems 1 0 0 Concurrency problems 22 10 9 High Severity Subtotal 109 22 22 Coding Standards, Best Practices, Other 88 605 6 Total Bugs 197 627 28 Coverity FindBug s Impact Distribution High Med-Low Copyright 2013, Coverity, Inc. Each solution found unique issues (neither is sufficient to replace the other)
  • 9. Here is a resource leak identified by FindBugs: • Identifies the problem and general location • But there’s no indication of the affected object/variable, the relevant code path or events • Developers need to figure it out on their own • Not a big deal in this simple code • Complex code will be a pain! Example: FindBugs Resource Leak Copyright 2013, Coverity, Inc.9 A leak might affect something on this line
  • 10. Here is a leak identified by Coverity: The object will continue to hold resources until the garbage collector eventually finalizes it—which may never happen. Example: Coverity Resource Leak Copyright 2013, Coverity, Inc.10 “listener” allocated. Implements Closeable, so it needs to be closed “listener” used, but still needs to be closed Leak: no longer usable, and never closed
  • 11. Example: Coverity Race Condition 11 Copyright 2013, Coverity, Inc. This is an HTTP request handler “o” is associated with session Another thread may modify the session Session attribute is deleted. The right one? Erroneous code path identified You may delete the wrong key! Good luck finding this manually!
  • 12. Example: Coverity Null Dereference Copyright 2013, Coverity, Inc.12 Passing null to function Dereferenced two layers deep You should check for null before or during the call to rebuild()
  • 13. Conclusion • Different analysis tools often find different (important and complementary) issues • Use multiple tools that find issues important to you • Avoid tools that take too long to analyze, require too much manual work or have too many false positives 13 Copyright 2013, Coverity, Inc.