{"id":1780,"date":"2012-09-24T01:00:00","date_gmt":"2012-09-24T01:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/fixing-common-java-security-code-violations-in-sonar.html"},"modified":"2012-10-22T06:45:49","modified_gmt":"2012-10-22T06:45:49","slug":"fixing-common-java-security-code","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html","title":{"rendered":"Fixing common Java security code violations in Sonar"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code rules and violations and how <a href=\"http:\/\/onlysoftware.wordpress.com\/2011\/05\/19\/to-sonar-or-not-to-sonar\/\" target=\"_blank\" title=\"To Sonar or Not to Sonar ?\">Sonar <\/a>reports on them. However, if you haven\u2019t heard these terms before then you might take a look at <a href=\"http:\/\/docs.codehaus.org\/display\/SONAR\/Sonar+Concepts\" target=\"_blank\">Sonar Concepts<\/a> or the <a href=\"http:\/\/affiliate.manning.com\/idevaffiliate.php?id=1233_299\" target=\"_blank\">forthcoming book about Sonar<\/a> for a more detailed explanation.<\/p>\n<p>To get an idea, during Sonar analysis, your project is scanned by many tools to ensure that the source code conforms  with the rules you\u2019ve created in your <a href=\"http:\/\/docs.codehaus.org\/display\/SONAR\/Quality+Profiles\" target=\"_blank\">quality profile<\/a>. Whenever a rule is violated\u2026 well a violation is raised. With Sonar you can track these violations with violations drill down view or in the source code editor. There are hundreds of rules, categorized based on their importance. Ill try, in future posts, to cover as many as I can but for now let\u2019s take a look at some common security rules \/ violations. There are two pairs of rules (all of them are ranked as critical in Sonar ) we are going to examine right now.<br \/>\n<strong><br \/>\n<\/strong><strong>1. Array is Stored Directly ( <a href=\"http:\/\/pmd.sourceforge.net\/\" target=\"_blank\">PMD <\/a>) and Method returns internal array ( <a href=\"http:\/\/pmd.sourceforge.net\/\" target=\"_blank\">PMD <\/a>)<\/strong>       <\/p>\n<p>These violations appear in the cases when an internal Array is stored or returned directly from a method. The following example illustrates a simple class that violates these rules.        <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">public class CalendarYear {\r\n private String[] months;\r\n public String[] getMonths() {\r\n    return months;    \r\n }\r\n public void setMonths(String[] months) {\r\n    this.months = months;\r\n }\r\n}<\/pre>\n<p>To eliminate them you have to clone the Array before storing \/ returning it as shown in the following class implementation, so noone can modify or get the original data of your class but only a copy of them.        <\/p>\n<pre class=\"brush:java\">public class CalendarYear {\r\n private String[] months;\r\n public String[] getMonths() {\r\n    return months.clone();    \r\n }\r\n public void setMonths(String[] months) {\r\n    this.months = months.clone();\r\n }\r\n}<\/pre>\n<p><strong><br \/>\n<\/strong><strong>2. Nonconstant string passed to execute method on an SQL statement (<a href=\"http:\/\/findbugs.sourceforge.net\/\" target=\"_blank\">findbugs<\/a>) and A prepared statement is generated from a nonconstant String <a href=\"http:\/\/findbugs.sourceforge.net\/\" target=\"_blank\">(findbugs<\/a>)<\/strong>       <\/p>\n<p>Both rules are related to database access when using JDBC libraries. Generally there are two ways to execute an SQL Commants via JDBC connection : Statement and PreparedStatement. There is a lot of discussion about pros and cons but it\u2019s out of the scope of this post. Let\u2019s see how the first violation is raised based on the following source code snippet.        <\/p>\n<pre class=\"brush:java\">Statement stmt = conn.createStatement();\r\nString sqlCommand = 'Select * FROM customers WHERE name = '' + custName + ''';\r\nstmt.execute(sqlCommand);<\/pre>\n<p>You\u2019ve already noticed that the <em>sqlcommand<\/em> parameter passed to execute method is dynamically created during run-time which is not acceptable by this rule. Similar situations causes the second violation.        <\/p>\n<pre class=\"brush:java\">String sqlCommand = 'insert into customers (id, name)  values (?, ?)';\r\nStatement stmt = conn.prepareStatement(sqlCommand);<\/pre>\n<p>You can overcome this problems with three different ways. You can either use <a href=\"http:\/\/docs.oracle.com\/javase\/6\/docs\/api\/java\/lang\/StringBuilder.html\" target=\"_blank\">StringBuilder <\/a>or <a href=\"http:\/\/docs.oracle.com\/javase\/6\/docs\/api\/java\/lang\/String.html#format(java.lang.String, java.lang.Object...)\" target=\"_blank\">String.format<\/a> method to create the values of the string variables. If applicable you can define the SQL Commands as Constant in class declaration, but it\u2019s only for the case where the SQL command is not required to be changed in runtime. Let\u2019s re-write the first code snippet using StringBuilder        <\/p>\n<pre class=\"brush:java\">Statement stmt = conn.createStatement();\r\nstmt.execute(new StringBuilder('Select FROM customers WHERE name = '').\r\n                         append(custName).\r\n                         append(''').toString());<\/pre>\n<p>and using String.format        <\/p>\n<pre class=\"brush:java\">Statement stmt = conn.createStatement();\r\nString sqlCommand = String.format('Select * from customers where name = '%s'', custName);\r\nstmt.execute(sqlCommand);<\/pre>\n<p>For the second example you can just declare the sqlCommand as following        <\/p>\n<pre class=\"brush:java\">private static final SQLCOMMAND = insert into customers (id, name)  values (?, ?)';<\/pre>\n<p>There are more security rules such as the blocker Hardcoded constant database password but I assume that nobody is still hardcodes passwords in source code files\u2026        <\/p>\n<p>In following articles I\u2019m going to show you how to adhere to performance and bad practice rules. Until then I\u2019m waiting for your comments or suggestions.<\/p>\n<p>Happy coding and don&#8217;t forget to share!<\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/onlysoftware.wordpress.com\/2012\/09\/21\/fixing-common-java-security-code-violations-in-sonar\/\">Fixing common Java security code violations in Sonar<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Papapetrou P. Patroklos at the <a href=\"http:\/\/onlysoftware.wordpress.com\/\">Only Software matters<\/a> blog.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code rules and violations and how Sonar reports on them. However, if you haven\u2019t heard these terms before then you might take a look at Sonar Concepts or &hellip;<\/p>\n","protected":false},"author":64,"featured_media":236,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[297,328],"class_list":["post-1780","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-security","tag-sonar"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Fixing common Java security code violations in Sonar - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fixing common Java security code violations in Sonar - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-09-24T01:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-22T06:45:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/sonar-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Patroklos Papapetrou\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/ppapapetrou76\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patroklos Papapetrou\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html\"},\"author\":{\"name\":\"Patroklos Papapetrou\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/306c93f02aabd80cae8b781932e161ce\"},\"headline\":\"Fixing common Java security code violations in Sonar\",\"datePublished\":\"2012-09-24T01:00:00+00:00\",\"dateModified\":\"2012-10-22T06:45:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html\"},\"wordCount\":551,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/sonar-logo.jpg\",\"keywords\":[\"Security\",\"Sonar\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html\",\"name\":\"Fixing common Java security code violations in Sonar - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/sonar-logo.jpg\",\"datePublished\":\"2012-09-24T01:00:00+00:00\",\"dateModified\":\"2012-10-22T06:45:49+00:00\",\"description\":\"This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/sonar-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/sonar-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/09\\\/fixing-common-java-security-code.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Fixing common Java security code violations in Sonar\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/306c93f02aabd80cae8b781932e161ce\",\"name\":\"Patroklos Papapetrou\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/068e4c534d3e9bd6075c2a452a633d49ee26a626fcef6c8a856813b08216e24d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/068e4c534d3e9bd6075c2a452a633d49ee26a626fcef6c8a856813b08216e24d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/068e4c534d3e9bd6075c2a452a633d49ee26a626fcef6c8a856813b08216e24d?s=96&d=mm&r=g\",\"caption\":\"Patroklos Papapetrou\"},\"description\":\"Patroklos is an experienced JavaEE Software Engineer and an Agile enthusiast seeking excellence in software quality. He is also co-Author of the Sonar in Action book, and contributor of several Sonar plugins.\",\"sameAs\":[\"http:\\\/\\\/onlysoftware.wordpress.com\",\"http:\\\/\\\/gr.linkedin.com\\\/in\\\/ppapapetrou\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/ppapapetrou76\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Patroklos-Papapetrou\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Fixing common Java security code violations in Sonar - Java Code Geeks","description":"This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html","og_locale":"en_US","og_type":"article","og_title":"Fixing common Java security code violations in Sonar - Java Code Geeks","og_description":"This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code","og_url":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-09-24T01:00:00+00:00","article_modified_time":"2012-10-22T06:45:49+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/sonar-logo.jpg","type":"image\/jpeg"}],"author":"Patroklos Papapetrou","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/ppapapetrou76","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Patroklos Papapetrou","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html"},"author":{"name":"Patroklos Papapetrou","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/306c93f02aabd80cae8b781932e161ce"},"headline":"Fixing common Java security code violations in Sonar","datePublished":"2012-09-24T01:00:00+00:00","dateModified":"2012-10-22T06:45:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html"},"wordCount":551,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/sonar-logo.jpg","keywords":["Security","Sonar"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html","url":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html","name":"Fixing common Java security code violations in Sonar - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/sonar-logo.jpg","datePublished":"2012-09-24T01:00:00+00:00","dateModified":"2012-10-22T06:45:49+00:00","description":"This article aims to show you how to quickly fix the most common java security code violations. It assumes that you are familiar with the concept of code","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/sonar-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/sonar-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/09\/fixing-common-java-security-code.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Fixing common Java security code violations in Sonar"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/306c93f02aabd80cae8b781932e161ce","name":"Patroklos Papapetrou","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/068e4c534d3e9bd6075c2a452a633d49ee26a626fcef6c8a856813b08216e24d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/068e4c534d3e9bd6075c2a452a633d49ee26a626fcef6c8a856813b08216e24d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/068e4c534d3e9bd6075c2a452a633d49ee26a626fcef6c8a856813b08216e24d?s=96&d=mm&r=g","caption":"Patroklos Papapetrou"},"description":"Patroklos is an experienced JavaEE Software Engineer and an Agile enthusiast seeking excellence in software quality. He is also co-Author of the Sonar in Action book, and contributor of several Sonar plugins.","sameAs":["http:\/\/onlysoftware.wordpress.com","http:\/\/gr.linkedin.com\/in\/ppapapetrou\/","https:\/\/x.com\/https:\/\/twitter.com\/ppapapetrou76"],"url":"https:\/\/www.javacodegeeks.com\/author\/Patroklos-Papapetrou"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1780"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1780\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/236"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}