<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Adam+Boulton</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Adam+Boulton"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Adam_Boulton"/>
		<updated>2026-05-31T13:25:10Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:Adam_Boulton_Security_Assessing_Java_RMI_-_OWASP_NYC.ppt&amp;diff=58570</id>
		<title>File:Adam Boulton Security Assessing Java RMI - OWASP NYC.ppt</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:Adam_Boulton_Security_Assessing_Java_RMI_-_OWASP_NYC.ppt&amp;diff=58570"/>
				<updated>2009-04-09T07:27:26Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: Security Assessing Java RMI&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Security Assessing Java RMI&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=58569</id>
		<title>User:Adam Boulton</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=58569"/>
				<updated>2009-04-09T07:26:14Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
&lt;br /&gt;
Adam Boulton is a Research Developer and Security Consultant for Corsaire. He has worked in IT Security since 2004, and has been programming since 2001. He graduated from Sheffield Hallam University in 2004 with a 1st Class BSc (Hons) Software Engineering Degree. Adam’s past roles have included that of a Software Engineer for the Ministry of Defence and a Virus Analyst for Sophos Plc. At both positions he was heavily involved in Software Development, Reverse Engineering and implementing security.&lt;br /&gt;
&lt;br /&gt;
== Specialties ==&lt;br /&gt;
&lt;br /&gt;
Java Development, Assembly, Reverse Engineering, Networking, Computer Forensics, Penetration Testing, Source code reviews, Web application security assessments.&lt;br /&gt;
&lt;br /&gt;
== LinkedIn Profile ==&lt;br /&gt;
[http://www.linkedin.com/profile?viewProfile=&amp;amp;key=12090735 Adam Boulton's LinkedIn Profile]&lt;br /&gt;
&lt;br /&gt;
== Presentations ==&lt;br /&gt;
&lt;br /&gt;
[[Media:Adam Boulton Security Assessing Java RMI - OWASP NYC.ppt]]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=58568</id>
		<title>User:Adam Boulton</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=58568"/>
				<updated>2009-04-09T07:25:16Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
&lt;br /&gt;
Adam Boulton is a Research Developer and Security Consultant for Corsaire. He has worked in IT Security since 2004, and has been programming since 2001. He graduated from Sheffield Hallam University in 2004 with a 1st Class BSc (Hons) Software Engineering Degree. Adam’s past roles have included that of a Software Engineer for the Ministry of Defence and a Virus Analyst for Sophos Plc. At both positions he was heavily involved in Software Development, Reverse Engineering and implementing security.&lt;br /&gt;
&lt;br /&gt;
== Specialties ==&lt;br /&gt;
&lt;br /&gt;
Java Development, Assembly, Reverse Engineering, Networking, Computer Forensics, Penetration Testing, Source code reviews, Web application security assessments.&lt;br /&gt;
&lt;br /&gt;
== LinkedIn Profile ==&lt;br /&gt;
[http://www.linkedin.com/profile?viewProfile=&amp;amp;key=12090735 Adam Boulton's LinkedIn Profile]&lt;br /&gt;
&lt;br /&gt;
== Presentations ==&lt;br /&gt;
&lt;br /&gt;
Security Assessing Java RMI [[Slides]]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_NYC_AppSec_2008_Conference&amp;diff=37545</id>
		<title>OWASP NYC AppSec 2008 Conference</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_NYC_AppSec_2008_Conference&amp;diff=37545"/>
				<updated>2008-08-29T12:34:19Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= 2008 OWASP USA, NYC =&lt;br /&gt;
Last Update: {{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scroll down to see speaker agenda, and training options &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[http://guest.cvent.com/i.aspx?4W,M3,828ca6d1-1b60-4105-8034-d344700e6956 http://www.owasp.org/images/6/61/Banner2_irfan.jpg]&amp;lt;/center&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[http://www.owasp.org/images/6/66/NY_Sponsorship_Form_update_%282%29.pdf Diamond Sponsor] - [http://www.imperva.com http://www.owasp.org/images/d/de/Imperva_2color_RGB.jpg]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[https://www.owasp.org/images/6/66/NY_Sponsorship_Form_update_%282%29.pdf Platinum Sponsor]  - [http://www.cenzic.com https://www.owasp.org/images/b/bf/CenzicLogo_RGB.gif]  - [http://www.whitehatsec.com http://www.owasp.org/images/archive/4/4d/20080703021901%21Whitehat.gif] -  [http://www-935.ibm.com/services/us/gbs/app/html/gbs_applicationservices.html?cm_re=masthead-_-business-_-apps-allappserv https://www.owasp.org/images/4/47/Ibm.jpg] &amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.owasp.org/images/6/66/NY_Sponsorship_Form_update_%282%29.pdf Gold, Silver &amp;amp; Other Sponsors] - [http://www.isc2.org http://www.owasp.org/images/4/45/Isc2logo.gif] - [http://www.f5.com http://www.owasp.org/images/7/7e/50px-F5_50px.jpg] - [http://www.aspectsecurity.com http://www.owasp.org/images/d/d1/Aspect_logo.gif] - [http://www.foundstone.com/us/education-overview.asp http://www.owasp.org/images/2/26/Foundstone.jpg] - [http://www.qualys.com https://www.owasp.org/images/a/ae/Qualys.gif] - [http://www.ouncelabs.com https://www.owasp.org/images/6/6e/OunceLabs_logo.jpg] - [http://www.fortify.com https://www.owasp.org/images/a/ac/Fortify.jpg] - [http://www.cigital.com/ https://www.owasp.org/images/b/be/Cigital_OWASP.GIF] - [http://www.acunetix.com https://www.owasp.org/images/e/eb/Acuneti.gif] - [http://www.accessitgroup.com https://www.owasp.org/images/6/6d/Accessit.JPG] - &lt;br /&gt;
[http://www.fishnetsecurity.com https://www.owasp.org/images/4/4a/Fishnet_security.png] - [http://www.arctecgroup.net http://www.owasp.org/images/b/bf/Arctec.jpg] - [http://www.airtightnetworks.net https://www.owasp.org/images/8/8b/Airtight.gif] - &lt;br /&gt;
[http://www.artofdefence.com https://www.owasp.org/images/d/dc/AOD_Logo.gif] - &lt;br /&gt;
[http://www.securityuniversity.net https://www.owasp.org/images/0/0d/Security_university.jpg] - &lt;br /&gt;
[http://www.breach.com https://www.owasp.org/images/9/9c/Breach_logo.gif] - [http://www.armorize.com https://www.owasp.org/images/c/ce/Armorize_Logo.png] -[http://www.barracudanetworks.com/ https://www.owasp.org/images/a/a2/Barracuda_Color_Logo.jpg] ~ [http://www.owasp.org/images/6/66/NY_Sponsorship_Form_update_%282%29.pdf http://www.owasp.org/images/f/f8/Sponsorsm.gif]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[https://www.owasp.org/images/6/66/NY_Sponsorship_Form_update_%282%29.pdf Sponsorship Opportunities] -- [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-PRESS Press Registration] -- [http://www.owasp.org/index.php/Member_Offers Other OWASP Member Offers] &amp;lt;/center&amp;gt; &lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
With assistance from: [http://www.webappsec.org WASC], [http://www.nym-infragard.us NYM InfraGard], [http://aitglobal.com AITGlobal], [http://nyphp.org/index.php NYC PHP], [http://www.nycbug.org NYCBUG], [http://www.isacany.net NYC ISACA], [http://www.nymissa.org NYC ISSA] and [http://www.pace.edu Pace University] you're invited to (2) days of Seminars and Technology Pavilion from the world's best application security technology minds, (2) days of hardcore hands-on training, all held at &amp;lt;b&amp;gt;[http://www.pace.edu/page.cfm?doc_id=16157 Pace University]&amp;lt;/b&amp;gt;, located in downtown New York City at &amp;lt;b&amp;gt;One Pace Plaza New York, NY 10038.&amp;lt;/b&amp;gt; Event Fees: $350 Members / $400 Non-Members / $200 for Students.  [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference#OWASP_NYC_AppSec_2008_Training_Courses_-_September_22nd_and_23rd.2C_2008 2 days of hands on training classes] are also available.&lt;br /&gt;
&amp;lt;center&amp;gt;[http://guest.cvent.com/i.aspx?4W,M3,828ca6d1-1b60-4105-8034-d344700e6956 http://www.owasp.org/images/7/7f/Register.gif]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
OWASP NYC's conference offers tracks for security and development professionals interested in learning how to secure applications and enterprises as well as organization leaders who want to learn more about the state of the appsec industry and its trends.  With two days of training and two days of sessions discussing cutting edge research presented by some of the brightest people in the industry, this event is a must attend for anyone looking to improve their information security posture. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2008 OWASP USA, NYC Conference Schedule – Sept 24th - Sept 25th ==&lt;br /&gt;
&amp;lt;center&amp;gt;[http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference/speakeragreement OWASP Speaker Agreement]&amp;lt;/center&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:80%&amp;quot; border=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | Day 1 – Sept 24th, 2008 &lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | || style=&amp;quot;width:30%; background:#BC857A&amp;quot; | Track 1: &lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; | Track 2: &lt;br /&gt;
 | style=&amp;quot;width:30%; background:#99FF99&amp;quot; | Track 3: &lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 07:30-10:00 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#C2C2C2&amp;quot; align=&amp;quot;center&amp;quot; | '''Doors Open for Attendee/Speaker Registration &amp;amp; [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference#Technology_Pavilion_-_September_24th_and_25th Exhibit/Sponsor Area]'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
 | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 09:00-09:45 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#F2F2F2&amp;quot; align=&amp;quot;center&amp;quot; | OWASP Version 3.0 who we are, where we are.. where we are going &lt;br /&gt;
''OWASP Foundation: [http://www.owasp.org/index.php/Contact Jeff Williams], [http://www.owasp.org/index.php/Contact Dinis Cruz], [http://www.owasp.org/index.php/Contact Dave Wichers], [http://www.linkedin.com/in/tombrennan Tom Brennan], [http://www.owasp.org/index.php/Contact Sebastien Deleersnyder], [http://www.owasp.org/index.php/Contact Paulo Coimbra], [http://www.owasp.org/index.php/Contact Kate Hartmann], [http://www.owasp.org/index.php/Contact Alison Shrader] &amp;amp; [http://www.owasp.org/index.php/Category:OWASP_Chapter#Chapter_Support_Materials all local chapter leaders]&lt;br /&gt;
'' &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 10:00-10:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; |  [http://www.owasp.org/index.php/AppSecEU08_Trends_in_Web_Hacking_Incidents:_What%27s_hot_for_2008 Analysis of the Web Hacking Incidents Database (WHID)]&lt;br /&gt;
''[http://blog.shezaf.com Ofer Shezaf]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.webappsecroadmap.com Web Application Security Road Map]  &amp;lt;br&amp;gt;&lt;br /&gt;
''[http://joesecurity.blogspot.com Joe White]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; |[https://buildsecurityin.us-cert.gov/swa/acqwg.html DHS Software Assurance Initiatives]&lt;br /&gt;
''[http://www.linkedin.com/pub/0/ab/3b7 Stan Wisseman] &amp;amp; [http://www.linkedin.com/pub/1/439/923 Joe Jarzombek]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 11:00-11:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Web Security Education using Open Source Tools&lt;br /&gt;
''Prof. Li-Chiou Chen &amp;amp; Chienitng Lin, [http://www.pace.edu/page.cfm?doc_id=16399 Pace Univ]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Http Bot Research&lt;br /&gt;
''[http://www.shadowserver.org/wiki/pmwiki.php?n=Shadowserver.Mission Andre M. DiMino - ShadowServer Foundation]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | MalSpam Research &lt;br /&gt;
'' [http://www.knujon.com/bios.html Garth Bruen]''&lt;br /&gt;
|-&lt;br /&gt;
 | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 12:00-13:00 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#F2F2F2&amp;quot; align=&amp;quot;center&amp;quot; |  [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference/ctf Capture the Flag] Sign-Up&lt;br /&gt;
''LUNCH - Provided by event sponsors @ TechExpo''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 12:00-12:30 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Cross-Site Scripting Filter Evasion&lt;br /&gt;
''Alexios Fakos''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Framework-level Threat Analysis: Adding Science to the Art of Source-code review&lt;br /&gt;
''[http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-rohit-sethi Rohit Sethi] &amp;amp; [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-sahba-kazerooni Sahba Kazerooni]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | Automated Web-based Malware Behavioral Analysis &lt;br /&gt;
''[http://www.linkedin.com/pub/3/359/b1a Tyler Hudak]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 13:00-13:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | OWASP Testing Guide - Offensive Assessing Financial Applications&lt;br /&gt;
'' [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-daniel-cuthbert Daniel Cuthbert]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | WAF ModSecurity&lt;br /&gt;
''[http://www.breach.com/company/executive-team/ Ivan Ristic]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | Using Layer 8 and OWASP to Secure Web Applications&lt;br /&gt;
''[http://www.linkedin.com/in/davidstern2000 David Stern] &amp;amp; [http://www.linkedin.com/in/romangarber Roman Garber]''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 14:00-14:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Critical exploits... let us count the ways&lt;br /&gt;
''[http://jeremiahgrossman.blogspot.com Jeremiah Grossman] &amp;amp; [http://ha.ckers.org/blog/about Robert &amp;quot;RSnake&amp;quot; Hansen],''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Security Assessing Java RMI &lt;br /&gt;
''[http://www.linkedin.com/in/adamboulton Adam Boulton]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | JBroFuzz 0.1 - 1.1: Building a Java Fuzzer for the Web &lt;br /&gt;
''[http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-SPEAKER-Yiannis_Pavlosoglou Yiannis Pavlosoglou]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 15:00-15:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; |Industry Outlook Panel: ''[http://www.linkedin.com/in/markclancy Mark Clancy] EVP CitiGroup, [http://www.linkedin.com/pub/0/497/86a Jim Routh] CISO DTCC, [http://www.linkedin.com/pub/0/bb1/68a Sunil Seshadri] CISO NYSE-Euronet, [http://www.linkedin.com/pub/0/1ba/4a9 Warren Axelrod] SVP Bank of America, [http://www.linkedin.com/in/bernik Joe Bernik] SVP, RBS,[http://www.linkedin.com/pub/8/878/240 Jennifer Bayuk] Infosec Consultant &amp;amp; [http://www.linkedin.com/in/philvenables Philip Venables] CISO, Goldman Sachs&lt;br /&gt;
[http://www.linkedin.com/in/crecalde Carlos Recalde] SVP, Lehman Brothers&lt;br /&gt;
[http://www.linkedin.com/in/mahidontamsetti Mahi Dontamsetti] Moderator''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/Wild_Wild_Web_on_Security_Planet Wild Wild Web on Security Planet]&lt;br /&gt;
''[http://www.securisksolutions.com/company/execmgt.aspx Mano Paul]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; |[http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-SPEAKER-GunterOllmann Multidisciplinary Bank Attacks]&lt;br /&gt;
''Gunter Ollmann''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 16:00-16:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | OWASP Enterprise Security API [http://www.owasp.org/index.php/ESAPI (ESAPI) Project]&lt;br /&gt;
'' [http://www.aspectsecurity.com/management.htm Jeff Williams]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Shootout @ Blackbox Corral&lt;br /&gt;
''Larry Suto ''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | Case Studies: Exploiting application testing tool deficiencies via &amp;quot;out of band&amp;quot; injection&lt;br /&gt;
''[http://www.linkedin.com/pub/0/a91/aa2 Vijay Akasapu] &amp;amp; [http://www.linkedin.com/pub/9/279/381 Marshall Heilman]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 17:00-17:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Threading the Needle:&lt;br /&gt;
&lt;br /&gt;
Bypassing web application/service security controls using Encoding, Transcoding, Filter Evasion, and other Canonicalization Attacks&lt;br /&gt;
'' [http://www.linkedin.com/in/arianevans Arian Evans]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; |Shhhh Don’t Tell Anybody &lt;br /&gt;
''[http://www.linkedin.com/in/ppetkov Petko D. Petkov]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-SPEAKER-Andres_Riancho w3af - A Framework to own the web]&lt;br /&gt;
''Andres Riancho''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 18:00-18:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/Category:OWASP_Live_CD_Project OWASP Live CD]&lt;br /&gt;
'' [http://www.linkedin.com/in/packetfocus Joshua Perrymon]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Coding Secure w/PHP&lt;br /&gt;
''[http://www.linkedin.com/in/zaunere Hans Zaunere]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/Payment_Card_Data_Security_and_the_new_Enterprise_Java Payment Card Data Security and the new Enterprise Java]&lt;br /&gt;
''[https://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-SPEAKER-Dr._B._V._Kumar Dr. B. V. Kumar] &amp;amp; [https://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-SPEAKER-Abhay_Bhargav Mr. Abhay Bhargav]''&lt;br /&gt;
|-&lt;br /&gt;
 | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 20:00-23:00 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#C2C2C2&amp;quot; align=&amp;quot;center&amp;quot; | OWASP NYC AppSec 2008 VIP Party&lt;br /&gt;
''Location: TBD''&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | Day 2 – Sept 25th, 2008 &lt;br /&gt;
|-&lt;br /&gt;
  | style=&amp;quot;width:10%; background:#99FF99&amp;quot; | 08:00-10:00 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#F2F2F2&amp;quot; align=&amp;quot;center&amp;quot; |  BREAKFAST - Provided by event sponsors @ TechExpo&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 08:00-08:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Software Development: The Last Security Frontier&lt;br /&gt;
''[http://blog.isc2.org/isc2_blog/tipton/index.html W. Hord Tipton], CISSP-ISSEP, CAP, CISA, CNSS and former Chief Information Officer for the U.S. Department of the Interior&lt;br /&gt;
Executive Director and member of the Board of Directors, (ISC)²''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/AppSecEU08_Best_Practices_Guide_Web_Application_Firewalls Best Practices Guide: Web Application Firewalls]&lt;br /&gt;
''Alexander Meisel''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | The Good The Bad and The Ugly - Pen Testing VS. Source Code Analysis&lt;br /&gt;
''[http://www.linkedin.com/in/tommyryan Thomas Ryan]'' &amp;amp; ''[http://www.linkedin.com/in/steveantoniewicz Steve Antoniewicz]''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 09:00-09:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.trutv.com/video/tiger-team/tiger-team-101-1-of-4.html APPSEC Red/Tiger Team Projects]&lt;br /&gt;
''[http://www.linkedin.com/pub/1/373/994 Chris Nickerson]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | OWASP &amp;quot;Google Hacking&amp;quot; Project &lt;br /&gt;
''[http://www.linkedin.com/in/ChristianHeinrich Christian Heinrich]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | OWASP Web Services Top Ten&lt;br /&gt;
''[http://1raindrop.typepad.com Gunnar Peterson]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 10:00-10:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Lets talk about OWASP....&lt;br /&gt;
''Dinis Cruz''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | &amp;quot;Help Wanted&amp;quot; [http://www.infosecleaders.com/survey 7 Things You Need to Know APPSEC/INFOSEC Employment]&lt;br /&gt;
''[http://www.linkedin.com/pub/0/29/685 Lee Kushner]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | Industry Analyst with Forrester Research&lt;br /&gt;
''[http://www.forrester.com/rb/analyst/chenxi_wang Chenxi Wang]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 11:00-11:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/Category:OWASP_CLASP_Project CLASP (Comprehensive, Lightweight Application Security Process)]&lt;br /&gt;
''Pravir Chandra''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Next Generation Cross Site Scripting Worms &lt;br /&gt;
''[http://i8jesus.com/?page_id=5 Arshan Dabirsiaghi]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | Secure Software Impact&lt;br /&gt;
''[http://ouncelabs.com/company/team.asp Jack Danahy]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 12:00-12:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Security in Agile Development&lt;br /&gt;
''[http://www.owasp.org/index.php/User:Wichers Dave Wichers]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Security of Software-as-a-Service (SaaS)&lt;br /&gt;
''[http://www.linkedin.com/pub/6/372/45a James Landis]''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | [http://reversebenchmarking.com/About.html Open Reverse Benchmarking Project]&lt;br /&gt;
''Marce Luck &amp;amp; [http://www.linkedin.com/pub/1/507/616 Tom Stracener]''&lt;br /&gt;
|-&lt;br /&gt;
 | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 12:00-13:00 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#F2F2F2&amp;quot; align=&amp;quot;center&amp;quot; | [http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference/ctf Capture the Flag] Status&lt;br /&gt;
''LUNCH - Provided @ TechExpo''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 13:00-13:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Security Research Report&lt;br /&gt;
''[http://www.linkedin.com/pub/5/742/233 Dinis Cruz]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Get Rich or Die Trying - Making Money on The Web, The Black Hat Way&lt;br /&gt;
''Trey Ford, Tom Brennan, Jeremiah Grossman''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | [https://www.owasp.org/index.php/User_talk:Jian Lotus Notes/Domino Web Application Security]&lt;br /&gt;
''[https://www.owasp.org/index.php/User_talk:Jian Jian Hui Wang]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 14:00-14:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Practical Advanced Threat Modeling&lt;br /&gt;
''John Steven''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/Category:OWASP_Orizon_Project The Owasp Orizon Project: towards version 1.0]&lt;br /&gt;
[https://www.owasp.org/index.php/User:Thesp0nge Paolo Perego]&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/Building_Usable_Security Building Usable Security]&lt;br /&gt;
[http://www.owasp.org/index.php/Zed_Abbadi Zed Abbadi]&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 15:00-15:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | [http://www.owasp.org/index.php/Input_validation:_the_Good%2C_the_Bad_and_the_Ugly Input validation: the Good, the Bad and the Ugly]&lt;br /&gt;
''[http://johanpeeters.com Johan Peeters]''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Off-shoring Application Development? Security is Still Your Problem&lt;br /&gt;
''Rohyt Belani''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | [[NIST SAMATE Static Analysis Tool Exposition (SATE)]]&lt;br /&gt;
''[http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference-vadim-okun Vadim Okun]''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 16:00-16:45 || style=&amp;quot;width:30%; background:#BC857A&amp;quot; align=&amp;quot;left&amp;quot; | Vulnerabilities in application interpreters and runtimes&lt;br /&gt;
''Erik Cabetas''&lt;br /&gt;
 | style=&amp;quot;width:30%; background:#BCA57A&amp;quot; align=&amp;quot;left&amp;quot; | Flash Parameter Injection (FPI)&lt;br /&gt;
''Ayal Yogev &amp;amp; Adi Sharabani''&lt;br /&gt;
| style=&amp;quot;width:30%; background:#99FF99&amp;quot; align=&amp;quot;left&amp;quot; | Mastering PCI Section 6.6&lt;br /&gt;
''[http://www.linkedin.com/pub/1/228/6a5 Taylor McKinley] and [http://www.linkedin.com/in/jacobwest Jacob West]''&lt;br /&gt;
|-&lt;br /&gt;
 | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 17:00-17:45 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#C2C2C2&amp;quot; align=&amp;quot;center&amp;quot; |  '''Wizdom of Crowds / CTF Awards &amp;amp; Raffles'''&lt;br /&gt;
|-&lt;br /&gt;
  | style=&amp;quot;width:10%; background:#7B8ABD&amp;quot; | 18:30-19:30 || colspan=&amp;quot;3&amp;quot; style=&amp;quot;width:80%; background:#C2C2C2&amp;quot; align=&amp;quot;center&amp;quot; | OWASP Foundation, Chapter Leader Meeting&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[http://guest.cvent.com/i.aspx?4W,M3,828ca6d1-1b60-4105-8034-d344700e6956 http://www.owasp.org/images/7/7f/Register.gif]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Technology Pavilion - September 24th and 25th  ==&lt;br /&gt;
&lt;br /&gt;
Want to see the latest offerings from technology product and service firms, visit the Technology Pavilion. On September 24th and 25th. 2 full days of exhibits by service providers and manufacturers from around the world.&lt;br /&gt;
&lt;br /&gt;
Do you want to preview the event space [http://www.flickr.com/photos/21550725@N04/sets/72157604662279903/detail Click Here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CPE Credits ==&lt;br /&gt;
&lt;br /&gt;
Much of the content is eligible for CPE credits.  Please check with your institution regarding specific requirements.&lt;br /&gt;
&lt;br /&gt;
'''The CISM cpe policy (www.isaca.org/cismcpepolicy) states''': &lt;br /&gt;
&lt;br /&gt;
One continuing professional education hour is earned for each fifty minutes of active participation (excluding lunches and breaks) in a professional educational activity. Continuing professional education hours are only earned in full-hour increments and rounding must be down. For example, a CISA who attends an eight-hour presentation (480 minutes) with 90 minutes of breaks will earn seven (7) continuing professional education hours.&lt;br /&gt;
&lt;br /&gt;
Activities that qualify for CPE must be directly applicable to the management, design or assessment of an enterprise's information security as per the CISM job practice&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Earn (ISC)2 CPE Credits at 2008 OWASP USA, NYC'''&lt;br /&gt;
&lt;br /&gt;
Attendance at the 2008 OWASP NYC Training Courses or Conferences will earn you Continuing Professional Education (CPE) credits as follows:&lt;br /&gt;
Training Courses: September 22-23, 2008&lt;br /&gt;
•	16 CPE units for 2 days of training (Monday - Tuesday) &lt;br /&gt;
•	8 CPE units for 1 day of training (Monday or Tuesday Only) &lt;br /&gt;
Conferences: September 24-25, 2008&lt;br /&gt;
Earn 1 CPE per hour of conference attendance&lt;br /&gt;
&lt;br /&gt;
== [http://www.owasp.org/index.php/Category:OWASP_AppSec_Conference_Training OWASP NYC AppSec 2008 Training Courses - September 22nd and 23rd, 2008] ==&lt;br /&gt;
{| style=&amp;quot;width:80%&amp;quot; border=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
 ! align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | T1. Defensive Programming - 2-Days - $1350&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;background:#F2F2F2&amp;quot; | This class will teach you how to program defensively. A must for developers, managers, testers and security professionals. Learn the latest techniques to build attack resistant code, protect from current and future vulnerabilities and how to secure an application from both implementation bugs and design flaws. The instructor Pravir Chandra is well known security expert, project lead for OWASP CLASP project and former co-founder &amp;amp; CTO of secure software [[:Category:OWASP_AppSec_Conference_Training | Learn More Here]]&lt;br /&gt;
&lt;br /&gt;
Instructor: Jason Rouse, Technical Manager, [http://www.cigital.com/training/series http://www.owasp.org/images/b/be/Cigital_OWASP.GIF]''' &lt;br /&gt;
 |-&lt;br /&gt;
{| style=&amp;quot;width:80%&amp;quot; border=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | T2. Secure Coding for Java EE - 2-Days - $1350&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;background:#F2F2F2&amp;quot; | This course is similar to Aspect's Building and Testing Secure Web Applications except it includes a significant amount of Java focused content, including:&lt;br /&gt;
# Java EE security overview,&lt;br /&gt;
# All coding examples and recommendations are specifically focused on Java and Java servers, and&lt;br /&gt;
# 3 additional hands on coding labs where the students find and then fix security vulnerabilities in a Java EE application developed for the class.&lt;br /&gt;
&lt;br /&gt;
[[:Category:OWASP_AppSec_Conference_Training | Learn More Here]]&lt;br /&gt;
&lt;br /&gt;
Instructor: Dave Wichers: [http://www.aspectsecurity.com http://www.owasp.org/images/d/d1/Aspect_logo.gif]&lt;br /&gt;
'''&lt;br /&gt;
 |-&lt;br /&gt;
 ! align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | T3. Web Services and XML Security - 2-Days - $1350&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;background:#F2F2F2&amp;quot; | The movement towards Web Services and Service Oriented architecture (SOA) paradigms requires new security paradigms to deal with new risks posed by these architectures. This session takes a pragmatic approach towards identifying Web Services security risks and selecting and applying countermeasures to the application, code, web servers, databases, application, and identity servers and related software. [[:Category:OWASP_AppSec_Conference_Training | Learn More Here]]&lt;br /&gt;
&lt;br /&gt;
Instructor: Gunnar Peterson''' [http://www.arctecgroup.net https://www.owasp.org/images/b/bf/Arctec.jpg]&lt;br /&gt;
 |-&lt;br /&gt;
 ! align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | T4. Advanced Web Application Security Testing - 2-Days - $1350&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;background:#F2F2F2&amp;quot; | Course Overview While all developers need to know the basics of web application security testing, application security specialists will want to know all the advanced techniques for finding and diagnosing security problems in applications. Aspect’s Advanced Web Application Security Testing training is based on a decade of work verifying the security of critical applications. The course is taught by an experienced application security practitioner in an interactive manner. [[:Category:OWASP_AppSec_Conference_Training | Learn More Here]]&lt;br /&gt;
&lt;br /&gt;
Instructor: Eric Sheridan: [http://www.aspectsecurity.com http://www.owasp.org/images/d/d1/Aspect_logo.gif]'''&lt;br /&gt;
 |-&lt;br /&gt;
 ! align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | T5. Leading the Development of Secure Applications 1-Day - Sept 22nd- $675&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;background:#F2F2F2&amp;quot; |  In this one-day management session you’ll get the answers to the ten key questions that most CIOs and development managers face when trying to improve security in the development process.  The course provides proven techniques and valuable lessons learned that can be applied to projects at any phase of their application’s lifecycle. [[:Category:OWASP_AppSec_Conference_Training | Learn More Here]]&lt;br /&gt;
Instructor: John Pavone: [http://www.aspectsecurity.com http://www.owasp.org/images/d/d1/Aspect_logo.gif]'''&lt;br /&gt;
|-&lt;br /&gt;
 {| style=&amp;quot;width:80%&amp;quot; border=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | T6. Building Secure Rich Internet Applications 1-Day - Sept 23rd- $675&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;background:#F2F2F2&amp;quot; |  Rich Internet applications using technologies like Ajax, Flash, ActiveX, and Java Applets require special attention to secure. This one day training addresses the special issues that arise in this type of application development.  [[:Category:OWASP_AppSec_Conference_Training | Learn More Here]]&lt;br /&gt;
Instructor: Arshan Dabirsiaghi: [http://www.aspectsecurity.com http://www.owasp.org/images/d/d1/Aspect_logo.gif]'''&lt;br /&gt;
|-&lt;br /&gt;
 {| style=&amp;quot;width:80%&amp;quot; border=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 ! align=&amp;quot;center&amp;quot; style=&amp;quot;background:#4058A0; color:white&amp;quot; | T8. Writing Secure Code  ASP.NET - 2-Days - $1350&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;background:#F2F2F2&amp;quot; | Understand the key security features of the .NET platform, the common web security pitfalls developers make, and how to build secure and reliable web applications using ASP.NET. Students are lead through hands on code examples that highlight issues and prescribe solutions. [[:Category:OWASP_AppSec_Conference_Training | Learn More Here]]&lt;br /&gt;
&lt;br /&gt;
The instructors are Foundstone's Technical Director, Rudolph Araujo and Foundstone's Professional Services Conlultant, Alex Smolen. [http://www.foundstone.com/us/education-overview.asp https://www.owasp.org/images/2/26/Foundstone.jpg]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;center&amp;gt;[http://guest.cvent.com/i.aspx?4W,M3,828ca6d1-1b60-4105-8034-d344700e6956 https://www.owasp.org/images/7/7f/Register.gif]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt; HOTELS / TRAVEL &amp;lt;/h2&amp;gt;&lt;br /&gt;
[http://maps.google.com/maps?near=Pace+Plz,+New+York,+NY+10038+(Pace+University+New+York+Cmps)&amp;amp;geocode=15467452012610799558,40.711640,-74.005820&amp;amp;q=hotel&amp;amp;f=l&amp;amp;dq=Pace+University-New+York&amp;amp;ie=UTF8&amp;amp;z=15&amp;amp;om=0 Hotels in the area of the event]&lt;br /&gt;
&lt;br /&gt;
New York City MTA: http://www.mta.nyc.ny.us/nyct/index.html&lt;br /&gt;
&lt;br /&gt;
New York City Subway &amp;amp; walking directions: http://www.hopstop.com/?city=newyork&lt;br /&gt;
&lt;br /&gt;
New York Sights &amp;amp; Sounds - SightsSounds&lt;br /&gt;
&lt;br /&gt;
New York City Travel Guide - http://www.nytoday.com/&lt;br /&gt;
&lt;br /&gt;
New York City Attractions - http://www.nycvisit.com&lt;br /&gt;
&lt;br /&gt;
New York TV Show Tickets - Get free tickets to TV shows! - http://www.nytix.com/&lt;br /&gt;
&lt;br /&gt;
New York City local news: http://www.ny1news.com&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;EVENT SPONSORSHIP &amp;lt;/h2&amp;gt;The OWASP Conferences &amp;amp; Training security technologists including CSOs,admins, application admins, MIS directors, homeland defense chiefs. These important influencers drive buying decisions exclusive access to its audiences. OWASP has established strategic relationships with security—print publications, newsletters, portals, consultants,message—and leadership positioning OWASP events. OWASP’s mission is supported by organizations who share our application, and software security communities. This approach should be part of your mix.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;[https://www.owasp.org/images/6/66/NY_Sponsorship_Form_update_%282%29.pdf Sponsorship Opportunities]- Register online: [http://guest.cvent.com/i.aspx?4W,M3,09e3b490-ba93-4474-851e-be803b1a01c2 click here]&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21456</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21456"/>
				<updated>2007-09-05T10:56:12Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Immutable Objects / Wrapper Class Caching */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Immutable Objects / Wrapper Class Caching ==&lt;br /&gt;
Since Java 5, wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache. For example, the following code will create a cache:&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
or &lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
BigDecimal also uses caching but uses a different mechanism. While the other objects contain a inner class to deal with caching this is not true for BigDecimal, the caching is pre-defined in a static array and only covers 11 numbers, 0 to 10:&lt;br /&gt;
&lt;br /&gt;
 // Cache of common small BigDecimal values.&lt;br /&gt;
 private static final BigDecimal zeroThroughTen[] = {&lt;br /&gt;
 new BigDecimal(BigInteger.ZERO,		0,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.ONE,		1,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(2),	2,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(3),	3,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(4),	4,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(5),	5,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(6),	6,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(7),	7,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(8),	8,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.valueOf(9),	9,  0),&lt;br /&gt;
 new BigDecimal(BigInteger.TEN,		10, 0),&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;br /&gt;
&lt;br /&gt;
== Boolean Assignment ==&lt;br /&gt;
&lt;br /&gt;
Everyone appreciates the difference between &amp;quot;==&amp;quot; and &amp;quot;=&amp;quot; in Java. However, typos and mistakes are made, often the compiler will catch them. However, consider the following:&lt;br /&gt;
&lt;br /&gt;
 boolean theTruth = false;&lt;br /&gt;
 if (theTruth = true)&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is true&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is false;&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The result of any assignment expression is the value of the variable following the assignment. Therefore, the above will always result in &amp;quot;theTruth is true&amp;quot;. This only applies to booleans, so for example the following will not compile and would therefore be caught by the compiler:&lt;br /&gt;
&lt;br /&gt;
 int i = 1;&lt;br /&gt;
 if(i=0) {}&lt;br /&gt;
&lt;br /&gt;
As &amp;quot;i&amp;quot; is and integer the comparison would evaluate to (i=0) as 0 is the result of the assignment. A boolean would be expected, due the &amp;quot;if&amp;quot; statement.&lt;br /&gt;
&lt;br /&gt;
== Conditions ==&lt;br /&gt;
&lt;br /&gt;
Be on the look out for any nested &amp;quot;else if&amp;quot;. Consider the following code example:&lt;br /&gt;
&lt;br /&gt;
 int x = 3;&lt;br /&gt;
 if (x==5) {}&lt;br /&gt;
 else if (x&amp;lt;9)&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;x is less than 9&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else if (x&amp;lt;6)&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;x is less than 6&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;else&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Produces the output:&lt;br /&gt;
&lt;br /&gt;
 x is less then 9&lt;br /&gt;
 &lt;br /&gt;
So even though the second else if would equate to &amp;quot;true&amp;quot; it is never reached. This is because once an &amp;quot;else if&amp;quot; succeeds the remaining conditions will be not be processed.&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21291</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21291"/>
				<updated>2007-08-31T09:38:39Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Immutable Objects / Wrapper Class Caching */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However,consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Immutable Objects / Wrapper Class Caching ==&lt;br /&gt;
Since Java 5, wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache. For example, the following code will create a cache:&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
or &lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;br /&gt;
&lt;br /&gt;
== Boolean Assignment ==&lt;br /&gt;
&lt;br /&gt;
Everyone appreciates the difference between &amp;quot;==&amp;quot; and &amp;quot;=&amp;quot; in Java. However, typos and mistakes are made, often the compiler will catch them. However, consider the following:&lt;br /&gt;
&lt;br /&gt;
 boolean theTruth = false;&lt;br /&gt;
 if (theTruth = true)&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is true&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is false;&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The result of any assignment expression is the value of the variable following the assignment. Therefore, the above will always result in &amp;quot;theTruth is true&amp;quot;. This only applies to booleans, so for example the following will not compile and would therefore be caught by the compiler:&lt;br /&gt;
&lt;br /&gt;
 int i = 1;&lt;br /&gt;
 if(i=0) {}&lt;br /&gt;
&lt;br /&gt;
As &amp;quot;i&amp;quot; is and integer the comparison would evaluate to (i=0) as 0 is the result of the assignment. A boolean would be expected, due the &amp;quot;if&amp;quot; statement.&lt;br /&gt;
&lt;br /&gt;
== Conditions ==&lt;br /&gt;
&lt;br /&gt;
Be on the look out for any nested &amp;quot;else if&amp;quot;. Consider the following code example:&lt;br /&gt;
&lt;br /&gt;
 int x = 3;&lt;br /&gt;
 if (x==5) {}&lt;br /&gt;
 else if (x&amp;lt;9)&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;x is less than 9&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else if (x&amp;lt;6)&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;x is less than 6&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;else&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Produces the output:&lt;br /&gt;
&lt;br /&gt;
 x is less then 9&lt;br /&gt;
 &lt;br /&gt;
So even though the second else if would equate to &amp;quot;true&amp;quot; it is never reached. This is because once an &amp;quot;else if&amp;quot; succeeds the remaining conditions will be not be processed.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21258</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21258"/>
				<updated>2007-08-30T14:57:11Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Boolean Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Immutable Objects / Wrapper Class Caching ==&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;br /&gt;
&lt;br /&gt;
== Boolean Assignment ==&lt;br /&gt;
&lt;br /&gt;
Everyone appreciates the difference between &amp;quot;==&amp;quot; and &amp;quot;=&amp;quot; in Java. However, typos and mistakes are made, often the compiler will catch them. However, consider the following:&lt;br /&gt;
&lt;br /&gt;
 boolean theTruth = false;&lt;br /&gt;
 if (theTruth = true)&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is true&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is false;&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The result of any assignment expression is the value of the variable following the assignment. Therefore, the above will always result in &amp;quot;theTruth is true&amp;quot;. This only applies to booleans, so for example the following will not compile and would therefore be caught by the compiler:&lt;br /&gt;
&lt;br /&gt;
 int i = 1;&lt;br /&gt;
 if(i=0) {}&lt;br /&gt;
&lt;br /&gt;
As &amp;quot;i&amp;quot; is and integer the comparison would evaluate to (i=0) as 0 is the result of the assignment. A boolean would be expected, due the &amp;quot;if&amp;quot; statement.&lt;br /&gt;
&lt;br /&gt;
== Conditions ==&lt;br /&gt;
&lt;br /&gt;
Be on the look out for any nested &amp;quot;else if&amp;quot;. Consider the following code example:&lt;br /&gt;
&lt;br /&gt;
 int x = 3;&lt;br /&gt;
 if (x==5) {}&lt;br /&gt;
 else if (x&amp;lt;9)&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;x is less than 9&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else if (x&amp;lt;6)&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;x is less than 6&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   System.out.println(&amp;quot;else&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Produces the output:&lt;br /&gt;
&lt;br /&gt;
 x is less then 9&lt;br /&gt;
 &lt;br /&gt;
So even though the second else if would equate to &amp;quot;true&amp;quot; it is never reached. This is because once an &amp;quot;else if&amp;quot; succeeds the remaining conditions will be not be processed.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21023</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21023"/>
				<updated>2007-08-23T15:10:04Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Boolean Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Immutable Objects / Wrapper Class Caching ==&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;br /&gt;
&lt;br /&gt;
== Boolean Assignment ==&lt;br /&gt;
&lt;br /&gt;
Everyone appreciates the difference between &amp;quot;==&amp;quot; and &amp;quot;=&amp;quot; in Java. However, typos and mistakes are made, often the compiler will catch them. However, consider the following:&lt;br /&gt;
&lt;br /&gt;
 boolean theTruth = false;&lt;br /&gt;
 if (theTruth = true)&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is true&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is false;&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The result of any assignment expression is the value of the variable following the assignment. Therefore, the above will always result in &amp;quot;theTruth is true&amp;quot;. This only applies to booleans, so for example the following will not compile and would therefore be caught by the compiler:&lt;br /&gt;
&lt;br /&gt;
 int i = 1;&lt;br /&gt;
 if(i=0) {}&lt;br /&gt;
&lt;br /&gt;
As &amp;quot;i&amp;quot; is and integer the comparison would evaluate to (i=0) as 0 is the result of the assignment. A boolean would be expected, due the &amp;quot;if&amp;quot; statement.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21022</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21022"/>
				<updated>2007-08-23T15:06:15Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Boolean Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Immutable Objects / Wrapper Class Caching ==&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;br /&gt;
&lt;br /&gt;
== Boolean Assignment ==&lt;br /&gt;
&lt;br /&gt;
Everyone appreciates the difference between &amp;quot;==&amp;quot; and &amp;quot;=&amp;quot; in Java. However, typos and mistakes are made, often the compiler will catch them. However, consider the following:&lt;br /&gt;
&lt;br /&gt;
 boolean theTruth = false;&lt;br /&gt;
 if (theTruth = true)&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is true&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
  System.out.println(&amp;quot;theTruth is false;&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The above will always result in &amp;quot;theTruth is true&amp;quot;. This only applies to booleans, so for example the following will not compile and would therefore be caught by the compiler:&lt;br /&gt;
&lt;br /&gt;
 int i = 1;&lt;br /&gt;
 if(i=0) {}&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21021</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21021"/>
				<updated>2007-08-23T15:05:46Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Garbage Collection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Immutable Objects / Wrapper Class Caching ==&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;br /&gt;
&lt;br /&gt;
== Boolean Assignment ==&lt;br /&gt;
&lt;br /&gt;
Everyone appreciates the difference between &amp;quot;==&amp;quot; and &amp;quot;=&amp;quot; in Java. However, typos and mistakes are made, often the compiler will catch them. However, consider the following:&lt;br /&gt;
&lt;br /&gt;
 boolean theTruth = false;&lt;br /&gt;
 if (theTruth = true)&lt;br /&gt;
 {&lt;br /&gt;
	System.out.println(&amp;quot;theTruth is true&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
	System.out.println(&amp;quot;theTruth is false;&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The above will always result in &amp;quot;theTruth is true&amp;quot;. This only applies to booleans, so for example the following will not compile and would therefore be caught by the compiler:&lt;br /&gt;
&lt;br /&gt;
 int i = 1;&lt;br /&gt;
 if(i=0) {}&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21020</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21020"/>
				<updated>2007-08-23T14:42:21Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Immutable Objects / Wrapper Class Caching */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Immutable Objects / Wrapper Class Caching ==&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21019</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21019"/>
				<updated>2007-08-23T14:41:47Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Garbage Collection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Immutable Objects / Wrapper Class Caching ===&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
== Garbage Collection ==&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21018</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21018"/>
				<updated>2007-08-23T14:38:31Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Garbage Collection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Immutable Objects / Wrapper Class Caching ===&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
==== Garbage Collection ====&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;br /&gt;
* Garbage collection behaviour differs between JVMs.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21017</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=21017"/>
				<updated>2007-08-23T14:36:18Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Incrementing values */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Immutable Objects / Wrapper Class Caching ===&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
==== Garbage Collection ====&lt;br /&gt;
&lt;br /&gt;
By overriding &amp;quot;finalize()&amp;quot; will allow you to define you own code for what is potentially the same concept as a destructor. There are a couple of important points to remember:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;finalize()&amp;quot; will only ever by called once (at most) by the Garbage Collector.&lt;br /&gt;
* It is never a guarantee that &amp;quot;finalize()&amp;quot; will be called i.e that an object will be garbage collected.&lt;br /&gt;
* By overriding &amp;quot;finalize()&amp;quot; you can prevent an object from ever being deleted. For example, the object passes a reference of itself to another object.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=20694</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=20694"/>
				<updated>2007-08-09T11:34:36Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Immutable Objects / Wrapper Class Caching */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Immutable Objects / Wrapper Class Caching ===&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
As per Java Language Specification(JLS) the values discussed above are stored as immutable wrapper objects. This caching has been created because it is assumed these values / objects are used more frequently.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=20693</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=20693"/>
				<updated>2007-08-09T11:30:34Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Wrapper Class Caching */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Immutable Objects / Wrapper Class Caching ===&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=19626</id>
		<title>Cross-Site Request Forgery (CSRF)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=19626"/>
				<updated>2007-07-08T19:12:44Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Related Countermeasures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Request Forgery (CSRF) is an attack that tricks the victim into loading a page that contains a malicious request. It is malicious in the sense that it inherits the identity and privileges of the victim to perform an undesired function on the victim's behalf, like change the victim's e-mail address, home address, or password, or purchase something. CSRF attacks target functions that cause a state change on the server.&lt;br /&gt;
&lt;br /&gt;
For most sites, such a request will normally automatically include any credentials associated with the site, such as the user's session cookie, basic auth credentials, IP address, Windows domain credentials, etc.  Therefore, if the user has authenticated to the site, the site will have no way to distinguish this from a legitimate user request.&lt;br /&gt;
&lt;br /&gt;
In this way, the attacker can make the victim perform actions that they didn't intend to, such as logout, purchase item, change account information, or any other function provided by the vulnerable website.&lt;br /&gt;
&lt;br /&gt;
If it is possible to store the CSRF attack on the vulnerable site itself, by means such as cross-site scripting then the severity of the attack is amplified.  The likelihood is increased because the victim is more likely to view the page containing the attack than some random page on the Internet.  The likelihood of a successful attack is also increased because the victim is sure to be authenticated to the site already.&lt;br /&gt;
&lt;br /&gt;
Synonyms: CSRF attacks are also known by a number of other names, including XSRF, &amp;quot;Sea Surf&amp;quot;, Session Riding, Cross-Site Reference Forgery, Hostile Linking. Microsoft refers to this type of attack as a One-Click attack in their threat modeling process and many places in their online documentation.&lt;br /&gt;
&lt;br /&gt;
==How does the attack work?==&lt;br /&gt;
&lt;br /&gt;
There are numerous ways in which an end-user can be tricked into loading information from or submitting information to a web application. In order to execute an attack, we must first understand how to generate a malicious request for our victim to execute. Let us consider the following example: Alice wishes to transfer $100 to Bob using bank.com. The request generated by Alice will look similar to the following:&lt;br /&gt;
&lt;br /&gt;
 POST &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 Content-Length: 19;&lt;br /&gt;
 &lt;br /&gt;
 acct=BOB&amp;amp;amount=100&lt;br /&gt;
&lt;br /&gt;
However, Maria notices that the same web application will execute the same transfer using URL parameters as follows:&lt;br /&gt;
&lt;br /&gt;
 GET &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=BOB&amp;amp;amount=100&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
&lt;br /&gt;
Maria now decides to exploit this web application vulnerability using Alice as her victim. Maria first constructs the following URL which will transfer $100,000 from Alice's account to her account:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that her malicious request is generated, Maria must trick Alice into submitting the request. The most basic method is to send Alice an HTML email containing the following: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot;&amp;gt;View my Pictures!&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assuming Alice is authenticated with the application when she clicks the link, the transfer of $100,000 to Maria's account will occur. However, Maria realizes that if Alice clicks the link, then Alice will notice that a transfer has occurred. Therefore, Maria decides to hide the attack in a zero-byte image:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;img src=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot; width=&amp;quot;1&amp;quot; height=&amp;quot;1&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this image tag were included in the email, Alice would only see a little box indicating that the browser could not render the image. However, the browser ''will still'' submit the request to bank.com without any visual indication that the transfer has taken place.&lt;br /&gt;
&lt;br /&gt;
==Prevention measures that do '''NOT''' work==&lt;br /&gt;
&lt;br /&gt;
;Using a secret cookie&lt;br /&gt;
:Remember that all cookies, even the ''secret'' ones, will be submitted with every request. All authentication tokens will be submitted regardless of whether or not the end-user was tricked into submitting the request. Furthermore, session identifiers are simply used by the application container to associate the request with a specific session object. The session identifier does not verify that the end-user intended to submit the request.&lt;br /&gt;
&lt;br /&gt;
;Only accepting POST requests&lt;br /&gt;
:Applications can be developed to only accept POST requests for the execution of business logic. The misconception is that since the attacker cannot construct a malicious link, a CSRF attack cannot be executed. Unfortunately, this logic is incorrect. There are numerous methods in which an attacker can trick a victim into submitting a forged POST request. The two most common methods are through the use of phishing sites (sites which appear to look like another valid site) and through the use of XMLHTTPRequest in a Cross-Site Scripting attack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Threats==&lt;br /&gt;
&lt;br /&gt;
==Related Attacks==&lt;br /&gt;
&lt;br /&gt;
[[XSS]]&lt;br /&gt;
&lt;br /&gt;
==Related Vulnerabilities==&lt;br /&gt;
&lt;br /&gt;
==Related Countermeasures==&lt;br /&gt;
&lt;br /&gt;
* Add a per-request nonce to URL and all forms in addition to the standard session. This is also referred to as &amp;quot;form keys&amp;quot;. Many frameworks (ex, Drupal.org 4.7.4+) either have or are starting to include this type of protection &amp;quot;built-in&amp;quot; to every form so the programmer does not need to code this protection manually. &lt;br /&gt;
* TBD: Add a per-session nonce to URL and all forms&lt;br /&gt;
* TBD: Add a hash(session id, function name, server-side secret) to URL and all forms&lt;br /&gt;
* TBD: .NET - add session identifier to ViewState with MAC&lt;br /&gt;
* Checking HTTP referrer details can help mitigate the attack but does certainly not provide a bullet proof solution. By ensuring the HTTP posts have come from the original site means that the attacks from other sites will not function. However, if the CSRF attack was used in combination with XSS on the original site then this mechanism will not provide any protection.&lt;br /&gt;
* &amp;quot;Although cross-site request forgery is fundamentally a problem with the web application, not the user, users can help protect their accounts at poorly designed sites by logging off the site before visiting another, or clearing their browser's cookies at the end of each browser session.&amp;quot; -http://en.wikipedia.org/wiki/Cross-site_request_forgery#_note-1&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
; [http://www.cgisecurity.com/articles/csrf-faq.shtml The Cross-Site Request Forgery (CSRF/XSRF) FAQ]&lt;br /&gt;
: ''quote: &amp;quot;This paper serves as a living document for Cross-Site Request Forgery issues. This document will serve as a repository of information from existing papers, talks, and mailing list postings and will be updated as new information is discovered.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
; [[Testing for CSRF]]&lt;br /&gt;
: CSRF (aka Session riding) paper from the OWASP Testing Guide project (need to integrate)&lt;br /&gt;
&lt;br /&gt;
; [http://www.darkreading.com/document.asp?doc_id=107651&amp;amp;WT.svl=news1_2 CSRF Vulnerability: A 'Sleeping Giant']&lt;br /&gt;
: Overview Paper&lt;br /&gt;
&lt;br /&gt;
; [http://www.owasp.org/index.php/Image:OWASPAppSecEU2006_RequestRodeo.ppt RequestRodeo: Client Side Protection against Session Riding]&lt;br /&gt;
: Martin Johns and Justus Winter's interesting paper and presentation for the 4th OWASP AppSec Conference which described potential techniques that browsers could adopt to automatically provide CSRF protection - [http://www.owasp.org/index.php/Image:RequestRodeo-MartinJohns.pdf PDF paper]&lt;br /&gt;
&lt;br /&gt;
; [http://www.owasp.org/index.php/CSRF_Guard CSRF Guard]&lt;br /&gt;
: A J2EE Filter which appends a unique request token to each form and link in the HTML response&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=19625</id>
		<title>Cross-Site Request Forgery (CSRF)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=19625"/>
				<updated>2007-07-08T19:00:05Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Request Forgery (CSRF) is an attack that tricks the victim into loading a page that contains a malicious request. It is malicious in the sense that it inherits the identity and privileges of the victim to perform an undesired function on the victim's behalf, like change the victim's e-mail address, home address, or password, or purchase something. CSRF attacks target functions that cause a state change on the server.&lt;br /&gt;
&lt;br /&gt;
For most sites, such a request will normally automatically include any credentials associated with the site, such as the user's session cookie, basic auth credentials, IP address, Windows domain credentials, etc.  Therefore, if the user has authenticated to the site, the site will have no way to distinguish this from a legitimate user request.&lt;br /&gt;
&lt;br /&gt;
In this way, the attacker can make the victim perform actions that they didn't intend to, such as logout, purchase item, change account information, or any other function provided by the vulnerable website.&lt;br /&gt;
&lt;br /&gt;
If it is possible to store the CSRF attack on the vulnerable site itself, by means such as cross-site scripting then the severity of the attack is amplified.  The likelihood is increased because the victim is more likely to view the page containing the attack than some random page on the Internet.  The likelihood of a successful attack is also increased because the victim is sure to be authenticated to the site already.&lt;br /&gt;
&lt;br /&gt;
Synonyms: CSRF attacks are also known by a number of other names, including XSRF, &amp;quot;Sea Surf&amp;quot;, Session Riding, Cross-Site Reference Forgery, Hostile Linking. Microsoft refers to this type of attack as a One-Click attack in their threat modeling process and many places in their online documentation.&lt;br /&gt;
&lt;br /&gt;
==How does the attack work?==&lt;br /&gt;
&lt;br /&gt;
There are numerous ways in which an end-user can be tricked into loading information from or submitting information to a web application. In order to execute an attack, we must first understand how to generate a malicious request for our victim to execute. Let us consider the following example: Alice wishes to transfer $100 to Bob using bank.com. The request generated by Alice will look similar to the following:&lt;br /&gt;
&lt;br /&gt;
 POST &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 Content-Length: 19;&lt;br /&gt;
 &lt;br /&gt;
 acct=BOB&amp;amp;amount=100&lt;br /&gt;
&lt;br /&gt;
However, Maria notices that the same web application will execute the same transfer using URL parameters as follows:&lt;br /&gt;
&lt;br /&gt;
 GET &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=BOB&amp;amp;amount=100&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
&lt;br /&gt;
Maria now decides to exploit this web application vulnerability using Alice as her victim. Maria first constructs the following URL which will transfer $100,000 from Alice's account to her account:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that her malicious request is generated, Maria must trick Alice into submitting the request. The most basic method is to send Alice an HTML email containing the following: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot;&amp;gt;View my Pictures!&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assuming Alice is authenticated with the application when she clicks the link, the transfer of $100,000 to Maria's account will occur. However, Maria realizes that if Alice clicks the link, then Alice will notice that a transfer has occurred. Therefore, Maria decides to hide the attack in a zero-byte image:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;img src=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot; width=&amp;quot;1&amp;quot; height=&amp;quot;1&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this image tag were included in the email, Alice would only see a little box indicating that the browser could not render the image. However, the browser ''will still'' submit the request to bank.com without any visual indication that the transfer has taken place.&lt;br /&gt;
&lt;br /&gt;
==Prevention measures that do '''NOT''' work==&lt;br /&gt;
&lt;br /&gt;
;Using a secret cookie&lt;br /&gt;
:Remember that all cookies, even the ''secret'' ones, will be submitted with every request. All authentication tokens will be submitted regardless of whether or not the end-user was tricked into submitting the request. Furthermore, session identifiers are simply used by the application container to associate the request with a specific session object. The session identifier does not verify that the end-user intended to submit the request.&lt;br /&gt;
&lt;br /&gt;
;Only accepting POST requests&lt;br /&gt;
:Applications can be developed to only accept POST requests for the execution of business logic. The misconception is that since the attacker cannot construct a malicious link, a CSRF attack cannot be executed. Unfortunately, this logic is incorrect. There are numerous methods in which an attacker can trick a victim into submitting a forged POST request. The two most common methods are through the use of phishing sites (sites which appear to look like another valid site) and through the use of XMLHTTPRequest in a Cross-Site Scripting attack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Threats==&lt;br /&gt;
&lt;br /&gt;
==Related Attacks==&lt;br /&gt;
&lt;br /&gt;
[[XSS]]&lt;br /&gt;
&lt;br /&gt;
==Related Vulnerabilities==&lt;br /&gt;
&lt;br /&gt;
==Related Countermeasures==&lt;br /&gt;
&lt;br /&gt;
* Add a per-request nonce to URL and all forms in addition to the standard session. This is also referred to as &amp;quot;form keys&amp;quot;. Many frameworks (ex, Drupal.org 4.7.4+) either have or are starting to include this type of protection &amp;quot;built-in&amp;quot; to every form so the programmer does not need to code this protection manually. &lt;br /&gt;
* TBD: Add a per-session nonce to URL and all forms&lt;br /&gt;
* TBD: Add a hash(session id, function name, server-side secret) to URL and all forms&lt;br /&gt;
* TBD: .NET - add session identifier to ViewState with MAC&lt;br /&gt;
* &amp;quot;Although cross-site request forgery is fundamentally a problem with the web application, not the user, users can help protect their accounts at poorly designed sites by logging off the site before visiting another, or clearing their browser's cookies at the end of each browser session.&amp;quot; -http://en.wikipedia.org/wiki/Cross-site_request_forgery#_note-1&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
; [http://www.cgisecurity.com/articles/csrf-faq.shtml The Cross-Site Request Forgery (CSRF/XSRF) FAQ]&lt;br /&gt;
: ''quote: &amp;quot;This paper serves as a living document for Cross-Site Request Forgery issues. This document will serve as a repository of information from existing papers, talks, and mailing list postings and will be updated as new information is discovered.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
; [[Testing for CSRF]]&lt;br /&gt;
: CSRF (aka Session riding) paper from the OWASP Testing Guide project (need to integrate)&lt;br /&gt;
&lt;br /&gt;
; [http://www.darkreading.com/document.asp?doc_id=107651&amp;amp;WT.svl=news1_2 CSRF Vulnerability: A 'Sleeping Giant']&lt;br /&gt;
: Overview Paper&lt;br /&gt;
&lt;br /&gt;
; [http://www.owasp.org/index.php/Image:OWASPAppSecEU2006_RequestRodeo.ppt RequestRodeo: Client Side Protection against Session Riding]&lt;br /&gt;
: Martin Johns and Justus Winter's interesting paper and presentation for the 4th OWASP AppSec Conference which described potential techniques that browsers could adopt to automatically provide CSRF protection - [http://www.owasp.org/index.php/Image:RequestRodeo-MartinJohns.pdf PDF paper]&lt;br /&gt;
&lt;br /&gt;
; [http://www.owasp.org/index.php/CSRF_Guard CSRF Guard]&lt;br /&gt;
: A J2EE Filter which appends a unique request token to each form and link in the HTML response&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=19624</id>
		<title>Cross-Site Request Forgery (CSRF)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=19624"/>
				<updated>2007-07-08T18:58:37Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Request Forgery (CSRF) is an attack that tricks the victim into loading a page that contains a malicious request. It is malicious in the sense that it inherits the identity and privileges of the victim to perform an undesired function on the victim's behalf, like change the victim's e-mail address, home address, or password, or purchase something. CSRF attacks target functions that cause a state change on the server.&lt;br /&gt;
&lt;br /&gt;
For most sites, such a request will normally automatically include any credentials associated with the site, such as the user's session cookie, basic auth credentials, IP address, Windows domain credentials, etc.  Therefore, if the user has authenticated to the site, the site will have no way to distinguish this from a legitimate user request.&lt;br /&gt;
&lt;br /&gt;
In this way, the attacker can make the victim perform actions that they didn't intend to, such as logout, purchase item, change account information, or any other function provided by the vulnerable website.&lt;br /&gt;
&lt;br /&gt;
If it is possible to store the CSRF attack on the vulnerable site itself, by means such as cross-site scripting then the severity of the attack is amplified.  The likelihood is increased because the victim is more likely to view the page containing the attack than some random page on the Internet.  The likelihood of a successful attack is also increased because the victim is sure to be authenticated to the site already.&lt;br /&gt;
&lt;br /&gt;
Synonyms: CSRF attacks are also known by a number of other names, including XSRF, Session Riding, Cross-Site Reference Forgery, and Hostile Linking. Microsoft refers to this type of attack as a One-Click attack in their threat modeling process and many places in their online documentation.&lt;br /&gt;
&lt;br /&gt;
==How does the attack work?==&lt;br /&gt;
&lt;br /&gt;
There are numerous ways in which an end-user can be tricked into loading information from or submitting information to a web application. In order to execute an attack, we must first understand how to generate a malicious request for our victim to execute. Let us consider the following example: Alice wishes to transfer $100 to Bob using bank.com. The request generated by Alice will look similar to the following:&lt;br /&gt;
&lt;br /&gt;
 POST &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 Content-Length: 19;&lt;br /&gt;
 &lt;br /&gt;
 acct=BOB&amp;amp;amount=100&lt;br /&gt;
&lt;br /&gt;
However, Maria notices that the same web application will execute the same transfer using URL parameters as follows:&lt;br /&gt;
&lt;br /&gt;
 GET &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=BOB&amp;amp;amount=100&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
&lt;br /&gt;
Maria now decides to exploit this web application vulnerability using Alice as her victim. Maria first constructs the following URL which will transfer $100,000 from Alice's account to her account:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that her malicious request is generated, Maria must trick Alice into submitting the request. The most basic method is to send Alice an HTML email containing the following: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot;&amp;gt;View my Pictures!&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assuming Alice is authenticated with the application when she clicks the link, the transfer of $100,000 to Maria's account will occur. However, Maria realizes that if Alice clicks the link, then Alice will notice that a transfer has occurred. Therefore, Maria decides to hide the attack in a zero-byte image:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;img src=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot; width=&amp;quot;1&amp;quot; height=&amp;quot;1&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this image tag were included in the email, Alice would only see a little box indicating that the browser could not render the image. However, the browser ''will still'' submit the request to bank.com without any visual indication that the transfer has taken place.&lt;br /&gt;
&lt;br /&gt;
==Prevention measures that do '''NOT''' work==&lt;br /&gt;
&lt;br /&gt;
;Using a secret cookie&lt;br /&gt;
:Remember that all cookies, even the ''secret'' ones, will be submitted with every request. All authentication tokens will be submitted regardless of whether or not the end-user was tricked into submitting the request. Furthermore, session identifiers are simply used by the application container to associate the request with a specific session object. The session identifier does not verify that the end-user intended to submit the request.&lt;br /&gt;
&lt;br /&gt;
;Only accepting POST requests&lt;br /&gt;
:Applications can be developed to only accept POST requests for the execution of business logic. The misconception is that since the attacker cannot construct a malicious link, a CSRF attack cannot be executed. Unfortunately, this logic is incorrect. There are numerous methods in which an attacker can trick a victim into submitting a forged POST request. The two most common methods are through the use of phishing sites (sites which appear to look like another valid site) and through the use of XMLHTTPRequest in a Cross-Site Scripting attack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Threats==&lt;br /&gt;
&lt;br /&gt;
==Related Attacks==&lt;br /&gt;
&lt;br /&gt;
[[XSS]]&lt;br /&gt;
&lt;br /&gt;
==Related Vulnerabilities==&lt;br /&gt;
&lt;br /&gt;
==Related Countermeasures==&lt;br /&gt;
&lt;br /&gt;
* Add a per-request nonce to URL and all forms in addition to the standard session. This is also referred to as &amp;quot;form keys&amp;quot;. Many frameworks (ex, Drupal.org 4.7.4+) either have or are starting to include this type of protection &amp;quot;built-in&amp;quot; to every form so the programmer does not need to code this protection manually. &lt;br /&gt;
* TBD: Add a per-session nonce to URL and all forms&lt;br /&gt;
* TBD: Add a hash(session id, function name, server-side secret) to URL and all forms&lt;br /&gt;
* TBD: .NET - add session identifier to ViewState with MAC&lt;br /&gt;
* &amp;quot;Although cross-site request forgery is fundamentally a problem with the web application, not the user, users can help protect their accounts at poorly designed sites by logging off the site before visiting another, or clearing their browser's cookies at the end of each browser session.&amp;quot; -http://en.wikipedia.org/wiki/Cross-site_request_forgery#_note-1&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
; [http://www.cgisecurity.com/articles/csrf-faq.shtml The Cross-Site Request Forgery (CSRF/XSRF) FAQ]&lt;br /&gt;
: ''quote: &amp;quot;This paper serves as a living document for Cross-Site Request Forgery issues. This document will serve as a repository of information from existing papers, talks, and mailing list postings and will be updated as new information is discovered.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
; [[Testing for CSRF]]&lt;br /&gt;
: CSRF (aka Session riding) paper from the OWASP Testing Guide project (need to integrate)&lt;br /&gt;
&lt;br /&gt;
; [http://www.darkreading.com/document.asp?doc_id=107651&amp;amp;WT.svl=news1_2 CSRF Vulnerability: A 'Sleeping Giant']&lt;br /&gt;
: Overview Paper&lt;br /&gt;
&lt;br /&gt;
; [http://www.owasp.org/index.php/Image:OWASPAppSecEU2006_RequestRodeo.ppt RequestRodeo: Client Side Protection against Session Riding]&lt;br /&gt;
: Martin Johns and Justus Winter's interesting paper and presentation for the 4th OWASP AppSec Conference which described potential techniques that browsers could adopt to automatically provide CSRF protection - [http://www.owasp.org/index.php/Image:RequestRodeo-MartinJohns.pdf PDF paper]&lt;br /&gt;
&lt;br /&gt;
; [http://www.owasp.org/index.php/CSRF_Guard CSRF Guard]&lt;br /&gt;
: A J2EE Filter which appends a unique request token to each form and link in the HTML response&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Code_Review_Guide_Table_of_Contents&amp;diff=19622</id>
		<title>OWASP Code Review Guide Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Code_Review_Guide_Table_of_Contents&amp;diff=19622"/>
				<updated>2007-07-07T10:50:20Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Examples by Vulnerability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Chapters Assigned|Chapters Assigned]]&lt;br /&gt;
==[[Code Review Guide Foreword|Foreword by OWASP Chair]]==&lt;br /&gt;
&lt;br /&gt;
==[[Code Review Guide Frontispiece |1. Frontispiece]]==&lt;br /&gt;
&lt;br /&gt;
'''[[Code Review Guide Frontispiece|1.1 About the OWASP Code Review Project]]'''&lt;br /&gt;
&lt;br /&gt;
Copyright&lt;br /&gt;
&lt;br /&gt;
Editors &lt;br /&gt;
&lt;br /&gt;
Authors and Reviewers &lt;br /&gt;
&lt;br /&gt;
Revision History &lt;br /&gt;
&lt;br /&gt;
Trademarks &lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]'''&lt;br /&gt;
&lt;br /&gt;
Overview &lt;br /&gt;
&lt;br /&gt;
Structure &lt;br /&gt;
&lt;br /&gt;
Licensing &lt;br /&gt;
&lt;br /&gt;
Participation and Membership &lt;br /&gt;
&lt;br /&gt;
Projects &lt;br /&gt;
&lt;br /&gt;
OWASP Privacy Policy &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Guide History==&lt;br /&gt;
[[Long long ago...]]&lt;br /&gt;
&lt;br /&gt;
==Methodology==&lt;br /&gt;
&lt;br /&gt;
#[[Code Review Introduction|Introduction]]&lt;br /&gt;
#[[Steps and Roles]]&lt;br /&gt;
#[[Code Review Processes]]&lt;br /&gt;
#[[Transaction Analysis]]&lt;br /&gt;
[[Category:OWASP Code Review Project]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Crawling Code==&lt;br /&gt;
#[[Introduction]]&lt;br /&gt;
#[[First sweep of the code base]]&lt;br /&gt;
#[[Getting dug in]]&lt;br /&gt;
&lt;br /&gt;
== Design review ==&lt;br /&gt;
#[[Designing for security]]&lt;br /&gt;
##[[.NET]]&lt;br /&gt;
##[[Java]]&lt;br /&gt;
##[[PHP]]&lt;br /&gt;
##[[C]]&lt;br /&gt;
##[[C++]] &lt;br /&gt;
##[[MySQL]]&lt;br /&gt;
##[[AJAX]]&lt;br /&gt;
&lt;br /&gt;
==Examples by Vulnerability==&lt;br /&gt;
#[[Reviewing Code for Buffer Overruns and Overflows]]&lt;br /&gt;
#[[Reviewing Code for OS Injection]]&lt;br /&gt;
#[[Reviewing Code for SQL Injection]]&lt;br /&gt;
#[[Reviewing Code for Data Validation]]&lt;br /&gt;
#[[Reviewing code for XSS issues]]&lt;br /&gt;
#[[Reviewing code for Cross-Site Request Forgery issues]]&lt;br /&gt;
#[[Reviewing Code for Error Handling]]&lt;br /&gt;
#[[Reviewing Code for Logging Issues]]&lt;br /&gt;
#[[Reviewing The Secure Code Environment]] &lt;br /&gt;
#[[Reviewing Code for Authorization Issues]]&lt;br /&gt;
#[[Reviewing Code for Authentication]]&lt;br /&gt;
#[[Reviewing Code for Session Integrity issues]]&lt;br /&gt;
#[[Reviewing Cryptographic Code]]&lt;br /&gt;
#[[Reviewing Code deployment: Dangerous HTTP Methods]]&lt;br /&gt;
#[[Reviewing Code for Race Conditions]]&lt;br /&gt;
&lt;br /&gt;
== Language specific best practice ==&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
#[[Java overview]]&lt;br /&gt;
#[[Java gotchas]]&lt;br /&gt;
#[[Java applet code review]]&lt;br /&gt;
#[[Java server (J2EE) code review]]&lt;br /&gt;
&lt;br /&gt;
===.NET===&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&lt;br /&gt;
===C===&lt;br /&gt;
#[[Memory management]]&lt;br /&gt;
#[[String management]]&lt;br /&gt;
#[[Secure access to file system items]]&lt;br /&gt;
&lt;br /&gt;
===RUBY===&lt;br /&gt;
&lt;br /&gt;
==[[Automating Code Reviews]]==&lt;br /&gt;
#[[Preface ]]&lt;br /&gt;
#[[Reasons for using automated tools]]&lt;br /&gt;
#[[Education and cultural change]]&lt;br /&gt;
#[[Tool Deployment Model]]&lt;br /&gt;
#[[Code Auditor Workbench Tool]]&lt;br /&gt;
&lt;br /&gt;
==[[References]]==&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Code Review Project]]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Searching_for_Code_in_J2EE/Java&amp;diff=19621</id>
		<title>Searching for Code in J2EE/Java</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Searching_for_Code_in_J2EE/Java&amp;diff=19621"/>
				<updated>2007-07-07T09:25:38Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* SQL &amp;amp; Database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Searching for key indicators ==&lt;br /&gt;
The basis of the code review is to locate and analyse areas of code which may have application security implications.&lt;br /&gt;
Assuming the code reviewer has a thorough understanding of the code, what it is intended to do and the context upon which it is to be used, firstly one needs to sweep the code base for areas of interest.&lt;br /&gt;
&lt;br /&gt;
This can be done by performing a text search on the code base looking for keywords relating to API's and functions.&lt;br /&gt;
Below is a guide for .NET framework 1.1 &amp;amp; 2.0&lt;br /&gt;
&lt;br /&gt;
=== Searching for code in .NET ===&lt;br /&gt;
&lt;br /&gt;
Firstly one needs to be familiar with the tools one can use in order to perform text searching following on from this one need to know what to look for.&lt;br /&gt;
 &lt;br /&gt;
In this section we will assume you have a copy of Visual Studio (VS) .NET at hand. VS has two types of search &amp;quot;'''Find in Files'''&amp;quot; and a cmd line tool called '''Findstr'''&lt;br /&gt;
  &lt;br /&gt;
The test search tools in XP is not great in my experience and if one has to use this make sure SP2 in installed as it works better.&lt;br /&gt;
To start off one should scan thorough the code looking for common patterns or keywords such as &amp;quot;User&amp;quot;, &amp;quot;Password&amp;quot;, &amp;quot;Pswd&amp;quot;, &amp;quot;Key&amp;quot;, &amp;quot;Http&amp;quot;, etc...&lt;br /&gt;
This can be done using the &amp;quot;Find in Files&amp;quot; tool in VS or using findstring as follows:&lt;br /&gt;
 &lt;br /&gt;
[Find In Files HERE]&lt;br /&gt;
&lt;br /&gt;
 '''findstr /s /m /i /d:c:\projects\codebase\sec &amp;quot;http&amp;quot; *.*'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Http Request Strings====&lt;br /&gt;
Requests from external sources are onviously a key area of a secure code review. We need to ensure that all HTTP requests received are datavalidated for composition, max and min length and if the data falls with the relms of the parameter whitelist.&lt;br /&gt;
Bottom-line is this is a key area to look at and ensure security is enabled.&lt;br /&gt;
&lt;br /&gt;
 request.querystring&lt;br /&gt;
 request.form &lt;br /&gt;
 request.cookies&lt;br /&gt;
 request.certificate&lt;br /&gt;
 request.servervariables&lt;br /&gt;
 request.IsSecureConnection&lt;br /&gt;
 request.TotalBytes&lt;br /&gt;
 request.BinaryRead&lt;br /&gt;
&lt;br /&gt;
====HTML Output====&lt;br /&gt;
Here we are looking for responses to the client. Responses which go unvalidated or which echo external input without data validation are key areas to examine. Many client side attacks result from poor response validation. XSS relies on this somewhat.&lt;br /&gt;
&lt;br /&gt;
 response.write&lt;br /&gt;
 &amp;lt;% =&lt;br /&gt;
 HttpUtility&lt;br /&gt;
 HtmlEncode&lt;br /&gt;
 UrlEncode&lt;br /&gt;
 innerText&lt;br /&gt;
 innerHTML&lt;br /&gt;
&lt;br /&gt;
====SQL &amp;amp; Database====&lt;br /&gt;
Locating where a database may be involved in the code is an important aspect of the code review. Looking at the database code will help determine if the application is vulnerable to SQL injection. One aspect of this is to verify that the code uses either ''SqlParameter'', ''OleDbParameter'', or ''OdbcParameter''(System.Data.SqlClient). These are typed and treats parameters as the literal value and not executable code in the database. &lt;br /&gt;
&lt;br /&gt;
 exec sp_executesql&lt;br /&gt;
 execute sp_executesql&lt;br /&gt;
 select from&lt;br /&gt;
 Insert&lt;br /&gt;
 update&lt;br /&gt;
 delete from where&lt;br /&gt;
 delete&lt;br /&gt;
 exec sp_&lt;br /&gt;
 execute sp_&lt;br /&gt;
 exec xp_&lt;br /&gt;
 execute sp_&lt;br /&gt;
 exec @&lt;br /&gt;
 execute @&lt;br /&gt;
 executestatement&lt;br /&gt;
 executeSQL&lt;br /&gt;
 setfilter&lt;br /&gt;
 executeQuery&lt;br /&gt;
 GetQueryResultInXML&lt;br /&gt;
 adodb&lt;br /&gt;
 sqloledb&lt;br /&gt;
 sql server&lt;br /&gt;
 driver&lt;br /&gt;
 Server.CreateObject&lt;br /&gt;
 .Provider&lt;br /&gt;
 .Open&lt;br /&gt;
 ADODB.recordset&lt;br /&gt;
 New OleDbConnection&lt;br /&gt;
 ExecuteReader&lt;br /&gt;
 DataSource&lt;br /&gt;
 SqlCommand&lt;br /&gt;
 Microsoft.Jet&lt;br /&gt;
 SqlDataReader&lt;br /&gt;
 ExecuteReader&lt;br /&gt;
 GetString&lt;br /&gt;
 SqlDataAdapter &lt;br /&gt;
 CommandType&lt;br /&gt;
 StoredProcedure&lt;br /&gt;
 System.Data.sql&lt;br /&gt;
&lt;br /&gt;
====Cookies====&lt;br /&gt;
Cookie manipulation can be key to various application security exploits such as session hijacking/fixation and parameter manipulation. One should examine any code relating to cookie functionality as this would have a bearing on session security.&lt;br /&gt;
 System.Net.Cookie &lt;br /&gt;
 HttpOnly&lt;br /&gt;
 document.cookie&lt;br /&gt;
&lt;br /&gt;
==== HTML Tags====&lt;br /&gt;
Many of the HTML tags below can be used for client side attacks such as cross site scritping. It is important to examine the context in which these tags are used and to examine any relevant data validation associated with the display and use of such tags withing a web application.&lt;br /&gt;
&lt;br /&gt;
 HtmlEncode &lt;br /&gt;
 URLEncode&lt;br /&gt;
 &amp;lt;applet&amp;gt; &lt;br /&gt;
 &amp;lt;frameset&amp;gt; &lt;br /&gt;
 &amp;lt;embed&amp;gt; &lt;br /&gt;
 &amp;lt;frame&amp;gt; &lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;iframe&amp;gt; &lt;br /&gt;
 &amp;lt;img&amp;gt; &lt;br /&gt;
 &amp;lt;style&amp;gt; &lt;br /&gt;
 &amp;lt;layer&amp;gt; &lt;br /&gt;
 &amp;lt;ilayer&amp;gt; &lt;br /&gt;
 &amp;lt;meta&amp;gt; &lt;br /&gt;
 &amp;lt;object&amp;gt; &lt;br /&gt;
 &amp;lt;body&amp;gt; &lt;br /&gt;
 &amp;lt;frame security&lt;br /&gt;
 &amp;lt;iframe security&lt;br /&gt;
&lt;br /&gt;
====Input Controls====&lt;br /&gt;
The input controls below are server classes used to produce and display web application form fields. Looking for such references helps locate entry points into the application.&lt;br /&gt;
&lt;br /&gt;
 system.web.ui.htmlcontrols.htmlinputhidden&lt;br /&gt;
 system.web.ui.webcontrols.textbox&lt;br /&gt;
 system.web.ui.webcontrols.listbox&lt;br /&gt;
 system.web.ui.webcontrols.checkboxlist&lt;br /&gt;
 system.web.ui.webcontrols.dropdownlist&lt;br /&gt;
&lt;br /&gt;
====web.config====&lt;br /&gt;
The .NET Framework relies on .config files to define configuration settings. The .config files are text-based XML files. Many .config files can, and typically do, exist on a single system. Web applications refer to a web.config file located in the application’s root directory. For ASP.NET applications, web.config contains information about most aspects of the application’s operation.&lt;br /&gt;
&lt;br /&gt;
 requestEncoding&lt;br /&gt;
 responseEncoding&lt;br /&gt;
 trace&lt;br /&gt;
 authorization&lt;br /&gt;
 CustomErrors&lt;br /&gt;
 httpRuntime &lt;br /&gt;
 maxRequestLength&lt;br /&gt;
 debug&lt;br /&gt;
 forms protection&lt;br /&gt;
 appSettings&lt;br /&gt;
 ConfigurationSettings&lt;br /&gt;
 authentication mode&lt;br /&gt;
 allow&lt;br /&gt;
 deny&lt;br /&gt;
 credentials&lt;br /&gt;
 identity impersonate&lt;br /&gt;
 timeout&lt;br /&gt;
&lt;br /&gt;
====global.asax====&lt;br /&gt;
Each application has its own Global.asax if one is required. Global.asax sets the event code and values for an application using scripts. One must ensure that application variables do not contain sensitive information, as they are accessible to the whole application and to all users within it.&lt;br /&gt;
&lt;br /&gt;
 Application_OnAuthenticateRequest&lt;br /&gt;
 Application_OnAuthorizeRequest&lt;br /&gt;
 Session_OnStart&lt;br /&gt;
 Session_OnEnd&lt;br /&gt;
&lt;br /&gt;
====logging====&lt;br /&gt;
Logging can be a source of information leakage. It is important to examing all calls to the logging subsystem and to determine if any sensitive information is being logged. Common mistakes are logging userID in conjunction with passwords within the authentication functionality or logging database requests which may contains sensitive data.&lt;br /&gt;
&lt;br /&gt;
 log4net&lt;br /&gt;
 Console.WriteLine&lt;br /&gt;
 System.Diagnostics.Debug&lt;br /&gt;
 System.Diagnostics.Trace&lt;br /&gt;
&lt;br /&gt;
====Machine.config====&lt;br /&gt;
Its important that many variables in machine.config can be overridden in the web.config file for a particular application.&lt;br /&gt;
 validateRequest&lt;br /&gt;
 enableViewState&lt;br /&gt;
 enableViewStateMac&lt;br /&gt;
&lt;br /&gt;
====Threads and Concurrancy====&lt;br /&gt;
 Thread&lt;br /&gt;
 Dispose&lt;br /&gt;
&lt;br /&gt;
====Class Design====&lt;br /&gt;
 Public&lt;br /&gt;
 Sealed&lt;br /&gt;
&lt;br /&gt;
====Reflection, Serialization====&lt;br /&gt;
 ISerializable &lt;br /&gt;
 AllowPartiallyTrustedCallersAttribute&lt;br /&gt;
 GetObjectData &lt;br /&gt;
 StrongNameIdentityPermission&lt;br /&gt;
 StrongNameIdentity&lt;br /&gt;
&lt;br /&gt;
====Exceptions &amp;amp; Errors====&lt;br /&gt;
 catch{&lt;br /&gt;
 Finally&lt;br /&gt;
 trace enabled&lt;br /&gt;
 customErrors mode&lt;br /&gt;
&lt;br /&gt;
====Crypto====&lt;br /&gt;
 base64&lt;br /&gt;
 xor&lt;br /&gt;
 DES&lt;br /&gt;
 RC2&lt;br /&gt;
 System.Random&lt;br /&gt;
 Random&lt;br /&gt;
&lt;br /&gt;
====Storage====&lt;br /&gt;
 SecureString&lt;br /&gt;
 ProtectedMemory &lt;br /&gt;
&lt;br /&gt;
====Authorization, Assert &amp;amp; Revert====&lt;br /&gt;
 .RequestMinimum&lt;br /&gt;
 .RequestOptional&lt;br /&gt;
 Assert&lt;br /&gt;
 Debug.Assert&lt;br /&gt;
 CodeAccessPermission&lt;br /&gt;
 ReflectionPermission.MemberAccess&lt;br /&gt;
 SecurityPermission.ControlAppDomain&lt;br /&gt;
 SecurityPermission.UnmanagedCode&lt;br /&gt;
 SecurityPermission.SkipVerification&lt;br /&gt;
 SecurityPermission.ControlEvidence&lt;br /&gt;
 SecurityPermission.SerializationFormatter&lt;br /&gt;
 SecurityPermission.ControlPrincipal&lt;br /&gt;
 SecurityPermission.ControlDomainPolicy&lt;br /&gt;
 SecurityPermission.ControlPolicy&lt;br /&gt;
&lt;br /&gt;
====Leagcy methods====&lt;br /&gt;
 printf&lt;br /&gt;
 strcpy&lt;br /&gt;
&lt;br /&gt;
=== Searching for code in J2EE/Java ===&lt;br /&gt;
&lt;br /&gt;
====Input Streams====&lt;br /&gt;
 Java.io&lt;br /&gt;
 FileInputStream&lt;br /&gt;
 ObjectInputStream&lt;br /&gt;
 FilterInputStream&lt;br /&gt;
 PipedInputStream&lt;br /&gt;
 SequenceInputStream&lt;br /&gt;
 StringBufferInputStream&lt;br /&gt;
 BufferedReader&lt;br /&gt;
 ByteArrayInputStream&lt;br /&gt;
 CharArrayReader&lt;br /&gt;
 File&lt;br /&gt;
 ObjectInputStream&lt;br /&gt;
 PipedInputStream&lt;br /&gt;
 StreamTokenizer&lt;br /&gt;
 getResourceAsStream&lt;br /&gt;
&lt;br /&gt;
====Servlets====&lt;br /&gt;
 javax.servlet.&lt;br /&gt;
 getParameterNames&lt;br /&gt;
 getParameterValues&lt;br /&gt;
 getAttribute&lt;br /&gt;
 getAttributeNames&lt;br /&gt;
 isSecure&lt;br /&gt;
 HttpServletRequest&lt;br /&gt;
 getQueryString&lt;br /&gt;
 getHeader&lt;br /&gt;
 getPrincipal&lt;br /&gt;
 isUserInRole&lt;br /&gt;
 getOutputStream&lt;br /&gt;
 getWriter&lt;br /&gt;
 addCookie&lt;br /&gt;
 addHeader&lt;br /&gt;
 setHeader&lt;br /&gt;
 &lt;br /&gt;
====SQL &amp;amp; Database====&lt;br /&gt;
Searching for Java Database related code this list should help you pinpoint classes/methods which are involved in the persistance layer of the application being reviewed.&lt;br /&gt;
 jdbc&lt;br /&gt;
 executeQuery&lt;br /&gt;
 select&lt;br /&gt;
 insert&lt;br /&gt;
 update&lt;br /&gt;
 delete&lt;br /&gt;
 execute&lt;br /&gt;
 executestatement&lt;br /&gt;
====SSL====&lt;br /&gt;
 com.sun.net.ssl&lt;br /&gt;
 SSLContext&lt;br /&gt;
 SSLSocketFactory&lt;br /&gt;
 TrustManagerFactory&lt;br /&gt;
 HttpsURLConnection&lt;br /&gt;
 KeyManagerFactory&lt;br /&gt;
&lt;br /&gt;
====Session Management====&lt;br /&gt;
 getSession&lt;br /&gt;
 invalidate&lt;br /&gt;
 getId &lt;br /&gt;
&lt;br /&gt;
====Data Validation====&lt;br /&gt;
&lt;br /&gt;
====Legacy Interaction====&lt;br /&gt;
&lt;br /&gt;
====Crypto====&lt;br /&gt;
&lt;br /&gt;
====Security Manager====&lt;br /&gt;
&lt;br /&gt;
====System====&lt;br /&gt;
&lt;br /&gt;
====Logging====&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19388</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19388"/>
				<updated>2007-06-25T17:16:43Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Integer Caching */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Wrapper Class Caching===&lt;br /&gt;
Since Java 5 wrapper class caching was introduced.  The following is an examination of the cache created by an inner class, IntegerCache, located in the Integer cache.&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
The other wrapper classes (Byte, Short, Long, Character) also contain this caching mechanism. The Byte, Short and Long all contain the same caching principle to the Integer object. The Character class caches from 0 to 127. The negative cache is not created for the Character wrapper as these values do not represent a corresponding character. There is no caching for the Float object.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19373</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19373"/>
				<updated>2007-06-25T14:28:35Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Incrementing values */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Integer Caching===&lt;br /&gt;
Since Java 5 Integer caching was introduced.  When creating an Integer using the following code:&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 5&lt;br /&gt;
&lt;br /&gt;
Remember that the assignment completes before the increment, hence post-increment. Using the pre-increment will update the value&lt;br /&gt;
before the assignment. For example:&lt;br /&gt;
&lt;br /&gt;
 int x = 5;&lt;br /&gt;
 x = ++x;&lt;br /&gt;
 System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 6&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19372</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19372"/>
				<updated>2007-06-25T14:19:02Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Equality */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
&lt;br /&gt;
Also, be aware that:&lt;br /&gt;
&lt;br /&gt;
 String abc = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 String abc = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
are different. For example, consider the following:&lt;br /&gt;
&lt;br /&gt;
 String letters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
 String moreLetters = &amp;quot;abc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 System.out.println(letters==moreLetters);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
This is due to the compiler and runtime efficiency. In the compiled class file only one set of data &amp;quot;abc&amp;quot; is stored, not two. In this situation only one object is created, therefore the equality is true between these object. However, consider this:&lt;br /&gt;
&lt;br /&gt;
 String data = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
 String moreData = new String(&amp;quot;123&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
 System.out.println(data==moreData);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
Even though one set of data &amp;quot;123&amp;quot; is stored in the class this is still treated differently at runtime. An explicit instantiation is used to create the String objects. Therefore, in this case, two objects have been created, so the equality is false. It is important to note that &amp;quot;==&amp;quot; is always used for object equality and does not ever refer to the values in an object. Always use .equals when checking looking for a &amp;quot;meaningful&amp;quot; comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Integer Caching===&lt;br /&gt;
Since Java 5 Integer caching was introduced.  When creating an Integer using the following code:&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
Prints 5.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19314</id>
		<title>Java gotchas</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_gotchas&amp;diff=19314"/>
				<updated>2007-06-25T07:11:44Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Integer Caching */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Equality ==&lt;br /&gt;
Object equality is tested using the == operator, while value equality is tested using the .equals(Object) method.  For example:&lt;br /&gt;
 String one = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String two = new String(&amp;quot;abc&amp;quot;);&lt;br /&gt;
 String three = one;&lt;br /&gt;
 if (one != two) System.out.println(&amp;quot;The two objects are not the same.&amp;quot;);&lt;br /&gt;
 if (one.equals(two)) System.out.println(&amp;quot;But they do contain the same value&amp;quot;);&lt;br /&gt;
 if (one == three) System.out.println(&amp;quot;These two are the same, because they use the same reference.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
 The two objects are not the same.&lt;br /&gt;
 But they do contain the same value&lt;br /&gt;
 These two are the same, because they use the same reference.&lt;br /&gt;
=== Integer Caching===&lt;br /&gt;
Since Java 5 Integer caching was introduced.  When creating an Integer using the following code:&lt;br /&gt;
&lt;br /&gt;
 Integer myNumber = 10&lt;br /&gt;
Or&lt;br /&gt;
 Integer myNumber = Integer.valueOf(10);&lt;br /&gt;
&lt;br /&gt;
256 Integer objects are created in the range of -128 to 127 which are all stored in an Integer array.  This caching functionality can be seen by looking at the inner class, IntegerCache, which is found in Integer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 private static class IntegerCache &lt;br /&gt;
 {&lt;br /&gt;
   private IntegerCache(){}&lt;br /&gt;
   &lt;br /&gt;
   static final Integer cache[] = new Integer[-(-128) + 127 + 1];&lt;br /&gt;
 &lt;br /&gt;
   static &lt;br /&gt;
   {&lt;br /&gt;
     for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;
     cache[i] = new Integer(i - 128); &lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
    &lt;br /&gt;
 public static Integer valueOf(int i) &lt;br /&gt;
 {&lt;br /&gt;
	final int offset = 128;&lt;br /&gt;
	if (i &amp;gt;= -128 &amp;amp;&amp;amp; i &amp;lt;= 127) // must cache &lt;br /&gt;
        { &lt;br /&gt;
	    return IntegerCache.cache[i + offset];&lt;br /&gt;
	}&lt;br /&gt;
        return new Integer(i);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So when creating an object using Integer.valueOf or directly assigning a value to an Integer within the range of -128 to 127 the same object will be returned. Therefore, consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = 100;&lt;br /&gt;
 Integer p = 100;&lt;br /&gt;
 if (i == p)  System.out.println(&amp;quot;i and p are the same.&amp;quot;);&lt;br /&gt;
 if (i != p)   System.out.println(&amp;quot;i and p are different.&amp;quot;);	&lt;br /&gt;
 if(i.equals(p))  System.out.println(&amp;quot;i and p contain the same value.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The output is: &lt;br /&gt;
 i and p are the same.&lt;br /&gt;
 i and p contain the same value.&lt;br /&gt;
&lt;br /&gt;
It is important to note that object i and p only equate to true because they are the same object, the comparison is not based on the value, it is based on object equality. If Integer i and p are outside the range of -128 or 127 the cache is not used, therefore new objects are created. When doing a comparison for value always use the “.equals” method. It is also important to note that instantiating an Integer does not create this caching. So consider the following example:&lt;br /&gt;
&lt;br /&gt;
 Integer i = new Integer (100);&lt;br /&gt;
 Integer p = new Integer(100);&lt;br /&gt;
 if(i==p) System.out.println(“i and p are the same object”);&lt;br /&gt;
 if(i.equals(p)) System.out.println(“ i and p contain the same value”);&lt;br /&gt;
&lt;br /&gt;
In this circumstance, the output is only:&lt;br /&gt;
 &lt;br /&gt;
 i and p contain the same value&lt;br /&gt;
&lt;br /&gt;
Remember that “==” is always used for object equality, it has not been overloaded for comparing unboxed values.&lt;br /&gt;
&lt;br /&gt;
This behavior is documented in the [http://java.sun.com/docs/books/jls Java Language Specification] [http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 section 5.1.7]. Quoting from there:&lt;br /&gt;
:If the value ''p'' being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let ''r1'' and ''r2'' be the results of any two boxing conversions of ''p''. It is always the case that ''r1'' == ''r2''.&lt;br /&gt;
&lt;br /&gt;
== Incrementing values ==&lt;br /&gt;
Be careful of the post-increment operator:&lt;br /&gt;
&lt;br /&gt;
  int x = 5;&lt;br /&gt;
  x = x++;&lt;br /&gt;
  System.out.println( x );&lt;br /&gt;
&lt;br /&gt;
Prints 5.&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=19293</id>
		<title>User:Adam Boulton</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=19293"/>
				<updated>2007-06-23T16:16:14Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* LinkedIn Profile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
&lt;br /&gt;
Adam Boulton is a Research Developer and Security Consultant for Corsaire. He has worked in IT Security since 2004, and has been programming since 2001. He graduated from Sheffield Hallam University in 2004 with a 1st Class BSc (Hons) Software Engineering Degree. Adam’s past roles have included that of a Software Engineer for the Ministry of Defence and a Virus Analyst for Sophos Plc. At both positions he was heavily involved in Software Development, Reverse Engineering and implementing security.&lt;br /&gt;
&lt;br /&gt;
== Specialties ==&lt;br /&gt;
&lt;br /&gt;
Java Development, Assembly, Reverse Engineering, Networking, Computer Forensics, Penetration Testing, Source code reviews, Web application security assessments.&lt;br /&gt;
&lt;br /&gt;
== LinkedIn Profile ==&lt;br /&gt;
[http://www.linkedin.com/profile?viewProfile=&amp;amp;key=12090735 Adam Boulton's LinkedIn Profile]&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=19292</id>
		<title>User:Adam Boulton</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=19292"/>
				<updated>2007-06-23T16:05:53Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
&lt;br /&gt;
Adam Boulton is a Research Developer and Security Consultant for Corsaire. He has worked in IT Security since 2004, and has been programming since 2001. He graduated from Sheffield Hallam University in 2004 with a 1st Class BSc (Hons) Software Engineering Degree. Adam’s past roles have included that of a Software Engineer for the Ministry of Defence and a Virus Analyst for Sophos Plc. At both positions he was heavily involved in Software Development, Reverse Engineering and implementing security.&lt;br /&gt;
&lt;br /&gt;
== Specialties ==&lt;br /&gt;
&lt;br /&gt;
Java Development, Assembly, Reverse Engineering, Networking, Computer Forensics, Penetration Testing, Source code reviews, Web application security assessments.&lt;br /&gt;
&lt;br /&gt;
== LinkedIn Profile ==&lt;br /&gt;
http://www.linkedin.com/profile?viewProfile=&amp;amp;key=12090735&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=19291</id>
		<title>User:Adam Boulton</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Adam_Boulton&amp;diff=19291"/>
				<updated>2007-06-23T15:45:13Z</updated>
		
		<summary type="html">&lt;p&gt;Adam Boulton: New page: == Summary ==  Adam Boulton is a Research Developer and Security Consultant for Corsaire. He has worked in IT Security since 2004, and has been programming since 2001. He graduated from Sh...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
&lt;br /&gt;
Adam Boulton is a Research Developer and Security Consultant for Corsaire. He has worked in IT Security since 2004, and has been programming since 2001. He graduated from Sheffield Hallam University with a 1st Class BSc (Hons) Software Engineering Degree. Adam’s past roles have included that of a Software Engineer for the Ministry of Defence and a Virus Analyst for Sophos Plc. At both positions he was heavily involved in Software Development, Reverse Engineering and implementing security.&lt;br /&gt;
&lt;br /&gt;
== Specialties ==&lt;br /&gt;
&lt;br /&gt;
Java Development, Assembly, Reverse Engineering, Networking, Computer Forensics, Penetration Testing, Source code reviews, Web application security assessments.&lt;br /&gt;
&lt;br /&gt;
== LinkedIn Profile ==&lt;br /&gt;
http://www.linkedin.com/profile?viewProfile=&amp;amp;key=12090735&lt;/div&gt;</summary>
		<author><name>Adam Boulton</name></author>	</entry>

	</feed>