{"action":"created","comment":{"url":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/comments/151104333","pull_request_review_id":76756515,"id":151104333,"diff_hunk":"@@ -191,46 +203,79 @@ private ChargeRate executeQuery(int rateDefID, String category, String subCatego\n             }\n \n             connection = DBUtill.getDBConnection();\n+\n             if (connection == null) {\n-                throw new Exception(\"database connection cannot be established\");\n+                throw new AnalyticsPricingException(\"database connection cannot be established\");\n             }\n \n-            StringBuilder query = new StringBuilder(\"select rate_defname, rt.rate_typecode, rd.rate_defdefault, c.currencycode,rd.rate_defcategorybase,cat,sub,tariffname,\");\n-            query.append(\"tariffdesc, tariffdefaultval, tariffmaxcount, tariffexcessrate, tariffdefrate, tariffspcommission, tariffadscommission,\");\n-            query.append(\"tariffopcocommission, tariffsurchargeval, tariffsurchargeAds, tariffsurchargeOpco \");\n-            query.append(\"from rate_def rd,currency c,tariff tr,rate_type rt,\");\n-            query.append(\"(SELECT rate_defid, Null as cat, Null as sub,tariffid from rate_def where rate_defid =? \");\n-            query.append(\"union all\");\n-            query.append(\"(select rate_defid, (select categorycode from category where rc.parentcategoryid = category.categoryid) as cat,\");\n-            query.append(\"(select categorycode from category where rc.childcategoryid = category.categoryid) as sub,\");\n-            query.append(\"tariffid from rate_category rc where rc.rate_defid = ?)\");\n-            query.append(\") ct \");\n-            query.append(\"where ct.rate_defid = rd.rate_defid \");\n-            query.append(\"and rd.currencyid = c.currencyid \");\n-            query.append(\"and ct.tariffid = tr.tariffid \");\n-            query.append(\"and rd.rate_typeid = rt.rate_typeid \");\n-\n-            if (isCategory && isSubcategory) {\n-                query.append(\"and ct.cat = ? and ct.sub = ?\");\n-            } else if (isCategory) {\n-                query.append(\"and ct.cat = ? and ct.sub is null\");\n+            StringBuilder query = new StringBuilder();\n+            query.append(\"SELECT rate_defid,rate_typeid,rate_defcategorybase \");\n+            query.append(\"FROM rate_def \");\n+            query.append(\"WHERE rate_defid =?\");\n+\n+            preparedStatement = connection.prepareStatement(query.toString());\n+            preparedStatement.setInt(1, rateDefID);\n+            resultSet = preparedStatement.executeQuery();","path":"components/org.wso2telco.analytics.pricing/src/main/java/org/wso2telco/analytics/pricing/service/RateCardDAOImpl.java","position":185,"original_position":185,"commit_id":"e4e312d538e921b32e1fc707e114fbf5ef3cbc64","original_commit_id":"e4e312d538e921b32e1fc707e114fbf5ef3cbc64","user":{"login":"TelcoGitHubBot","id":31726654,"avatar_url":"https://avatars1.githubusercontent.com/u/31726654?v=4","gravatar_id":"","url":"https://api.github.com/users/TelcoGitHubBot","html_url":"https://github.com/TelcoGitHubBot","followers_url":"https://api.github.com/users/TelcoGitHubBot/followers","following_url":"https://api.github.com/users/TelcoGitHubBot/following{/other_user}","gists_url":"https://api.github.com/users/TelcoGitHubBot/gists{/gist_id}","starred_url":"https://api.github.com/users/TelcoGitHubBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TelcoGitHubBot/subscriptions","organizations_url":"https://api.github.com/users/TelcoGitHubBot/orgs","repos_url":"https://api.github.com/users/TelcoGitHubBot/repos","events_url":"https://api.github.com/users/TelcoGitHubBot/events{/privacy}","received_events_url":"https://api.github.com/users/TelcoGitHubBot/received_events","type":"User","site_admin":false},"body":"![BLOCKER](https://sonarsource.github.io/sonar-github/severity-blocker.png 'Severity: BLOCKER') Use try-with-resources or close this \"ResultSet\" in a \"finally\" clause. [![rule](https://sonarsource.github.io/sonar-github/rule.png)](http://ci.wso2telco.com:9000/coding_rules#rule_key=squid%3AS2095)\n","created_at":"2017-11-15T11:47:53Z","updated_at":"2017-11-15T11:47:53Z","html_url":"https://github.com/WSO2Telco/analytics-hub/pull/233#discussion_r151104333","pull_request_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/comments/151104333"},"html":{"href":"https://github.com/WSO2Telco/analytics-hub/pull/233#discussion_r151104333"},"pull_request":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233"}}},"pull_request":{"url":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233","id":152734439,"html_url":"https://github.com/WSO2Telco/analytics-hub/pull/233","diff_url":"https://github.com/WSO2Telco/analytics-hub/pull/233.diff","patch_url":"https://github.com/WSO2Telco/analytics-hub/pull/233.patch","issue_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/issues/233","number":233,"state":"open","locked":false,"title":"2.0.0","user":{"login":"maheshroshan","id":20349864,"avatar_url":"https://avatars1.githubusercontent.com/u/20349864?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshroshan","html_url":"https://github.com/maheshroshan","followers_url":"https://api.github.com/users/maheshroshan/followers","following_url":"https://api.github.com/users/maheshroshan/following{/other_user}","gists_url":"https://api.github.com/users/maheshroshan/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshroshan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshroshan/subscriptions","organizations_url":"https://api.github.com/users/maheshroshan/orgs","repos_url":"https://api.github.com/users/maheshroshan/repos","events_url":"https://api.github.com/users/maheshroshan/events{/privacy}","received_events_url":"https://api.github.com/users/maheshroshan/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-15T10:18:33Z","updated_at":"2017-11-15T11:47:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43dd2733f5327d84a87e0438169600feca185177","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233/commits","review_comments_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233/comments","review_comment_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/issues/233/comments","statuses_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/statuses/e4e312d538e921b32e1fc707e114fbf5ef3cbc64","head":{"label":"maheshroshan:2.0.0","ref":"2.0.0","sha":"e4e312d538e921b32e1fc707e114fbf5ef3cbc64","user":{"login":"maheshroshan","id":20349864,"avatar_url":"https://avatars1.githubusercontent.com/u/20349864?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshroshan","html_url":"https://github.com/maheshroshan","followers_url":"https://api.github.com/users/maheshroshan/followers","following_url":"https://api.github.com/users/maheshroshan/following{/other_user}","gists_url":"https://api.github.com/users/maheshroshan/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshroshan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshroshan/subscriptions","organizations_url":"https://api.github.com/users/maheshroshan/orgs","repos_url":"https://api.github.com/users/maheshroshan/repos","events_url":"https://api.github.com/users/maheshroshan/events{/privacy}","received_events_url":"https://api.github.com/users/maheshroshan/received_events","type":"User","site_admin":false},"repo":{"id":108842919,"name":"analytics-hub","full_name":"maheshroshan/analytics-hub","owner":{"login":"maheshroshan","id":20349864,"avatar_url":"https://avatars1.githubusercontent.com/u/20349864?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshroshan","html_url":"https://github.com/maheshroshan","followers_url":"https://api.github.com/users/maheshroshan/followers","following_url":"https://api.github.com/users/maheshroshan/following{/other_user}","gists_url":"https://api.github.com/users/maheshroshan/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshroshan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshroshan/subscriptions","organizations_url":"https://api.github.com/users/maheshroshan/orgs","repos_url":"https://api.github.com/users/maheshroshan/repos","events_url":"https://api.github.com/users/maheshroshan/events{/privacy}","received_events_url":"https://api.github.com/users/maheshroshan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maheshroshan/analytics-hub","description":"Analytics Reporting Packages for HUB","fork":true,"url":"https://api.github.com/repos/maheshroshan/analytics-hub","forks_url":"https://api.github.com/repos/maheshroshan/analytics-hub/forks","keys_url":"https://api.github.com/repos/maheshroshan/analytics-hub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maheshroshan/analytics-hub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maheshroshan/analytics-hub/teams","hooks_url":"https://api.github.com/repos/maheshroshan/analytics-hub/hooks","issue_events_url":"https://api.github.com/repos/maheshroshan/analytics-hub/issues/events{/number}","events_url":"https://api.github.com/repos/maheshroshan/analytics-hub/events","assignees_url":"https://api.github.com/repos/maheshroshan/analytics-hub/assignees{/user}","branches_url":"https://api.github.com/repos/maheshroshan/analytics-hub/branches{/branch}","tags_url":"https://api.github.com/repos/maheshroshan/analytics-hub/tags","blobs_url":"https://api.github.com/repos/maheshroshan/analytics-hub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maheshroshan/analytics-hub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maheshroshan/analytics-hub/git/refs{/sha}","trees_url":"https://api.github.com/repos/maheshroshan/analytics-hub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maheshroshan/analytics-hub/statuses/{sha}","languages_url":"https://api.github.com/repos/maheshroshan/analytics-hub/languages","stargazers_url":"https://api.github.com/repos/maheshroshan/analytics-hub/stargazers","contributors_url":"https://api.github.com/repos/maheshroshan/analytics-hub/contributors","subscribers_url":"https://api.github.com/repos/maheshroshan/analytics-hub/subscribers","subscription_url":"https://api.github.com/repos/maheshroshan/analytics-hub/subscription","commits_url":"https://api.github.com/repos/maheshroshan/analytics-hub/commits{/sha}","git_commits_url":"https://api.github.com/repos/maheshroshan/analytics-hub/git/commits{/sha}","comments_url":"https://api.github.com/repos/maheshroshan/analytics-hub/comments{/number}","issue_comment_url":"https://api.github.com/repos/maheshroshan/analytics-hub/issues/comments{/number}","contents_url":"https://api.github.com/repos/maheshroshan/analytics-hub/contents/{+path}","compare_url":"https://api.github.com/repos/maheshroshan/analytics-hub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maheshroshan/analytics-hub/merges","archive_url":"https://api.github.com/repos/maheshroshan/analytics-hub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maheshroshan/analytics-hub/downloads","issues_url":"https://api.github.com/repos/maheshroshan/analytics-hub/issues{/number}","pulls_url":"https://api.github.com/repos/maheshroshan/analytics-hub/pulls{/number}","milestones_url":"https://api.github.com/repos/maheshroshan/analytics-hub/milestones{/number}","notifications_url":"https://api.github.com/repos/maheshroshan/analytics-hub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maheshroshan/analytics-hub/labels{/name}","releases_url":"https://api.github.com/repos/maheshroshan/analytics-hub/releases{/id}","deployments_url":"https://api.github.com/repos/maheshroshan/analytics-hub/deployments","created_at":"2017-10-30T11:42:58Z","updated_at":"2017-10-30T11:43:03Z","pushed_at":"2017-11-15T11:45:27Z","git_url":"git://github.com/maheshroshan/analytics-hub.git","ssh_url":"git@github.com:maheshroshan/analytics-hub.git","clone_url":"https://github.com/maheshroshan/analytics-hub.git","svn_url":"https://github.com/maheshroshan/analytics-hub","homepage":null,"size":22641,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"WSO2Telco:2.0.0","ref":"2.0.0","sha":"2174917459167567eed63122e3f0e212aa605897","user":{"login":"WSO2Telco","id":15646154,"avatar_url":"https://avatars2.githubusercontent.com/u/15646154?v=4","gravatar_id":"","url":"https://api.github.com/users/WSO2Telco","html_url":"https://github.com/WSO2Telco","followers_url":"https://api.github.com/users/WSO2Telco/followers","following_url":"https://api.github.com/users/WSO2Telco/following{/other_user}","gists_url":"https://api.github.com/users/WSO2Telco/gists{/gist_id}","starred_url":"https://api.github.com/users/WSO2Telco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WSO2Telco/subscriptions","organizations_url":"https://api.github.com/users/WSO2Telco/orgs","repos_url":"https://api.github.com/users/WSO2Telco/repos","events_url":"https://api.github.com/users/WSO2Telco/events{/privacy}","received_events_url":"https://api.github.com/users/WSO2Telco/received_events","type":"Organization","site_admin":false},"repo":{"id":84906439,"name":"analytics-hub","full_name":"WSO2Telco/analytics-hub","owner":{"login":"WSO2Telco","id":15646154,"avatar_url":"https://avatars2.githubusercontent.com/u/15646154?v=4","gravatar_id":"","url":"https://api.github.com/users/WSO2Telco","html_url":"https://github.com/WSO2Telco","followers_url":"https://api.github.com/users/WSO2Telco/followers","following_url":"https://api.github.com/users/WSO2Telco/following{/other_user}","gists_url":"https://api.github.com/users/WSO2Telco/gists{/gist_id}","starred_url":"https://api.github.com/users/WSO2Telco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WSO2Telco/subscriptions","organizations_url":"https://api.github.com/users/WSO2Telco/orgs","repos_url":"https://api.github.com/users/WSO2Telco/repos","events_url":"https://api.github.com/users/WSO2Telco/events{/privacy}","received_events_url":"https://api.github.com/users/WSO2Telco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WSO2Telco/analytics-hub","description":"Analytics Reporting Packages for HUB","fork":false,"url":"https://api.github.com/repos/WSO2Telco/analytics-hub","forks_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/forks","keys_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/teams","hooks_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/hooks","issue_events_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/issues/events{/number}","events_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/events","assignees_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/assignees{/user}","branches_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/branches{/branch}","tags_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/tags","blobs_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/git/refs{/sha}","trees_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/statuses/{sha}","languages_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/languages","stargazers_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/stargazers","contributors_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/contributors","subscribers_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/subscribers","subscription_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/subscription","commits_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/commits{/sha}","git_commits_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/git/commits{/sha}","comments_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/comments{/number}","issue_comment_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/issues/comments{/number}","contents_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/contents/{+path}","compare_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/merges","archive_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/downloads","issues_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/issues{/number}","pulls_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls{/number}","milestones_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/milestones{/number}","notifications_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/labels{/name}","releases_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/releases{/id}","deployments_url":"https://api.github.com/repos/WSO2Telco/analytics-hub/deployments","created_at":"2017-03-14T04:45:06Z","updated_at":"2017-07-10T06:16:00Z","pushed_at":"2017-11-15T11:45:27Z","git_url":"git://github.com/WSO2Telco/analytics-hub.git","ssh_url":"git@github.com:WSO2Telco/analytics-hub.git","clone_url":"https://github.com/WSO2Telco/analytics-hub.git","svn_url":"https://github.com/WSO2Telco/analytics-hub","homepage":null,"size":22655,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":1,"forks":9,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233"},"html":{"href":"https://github.com/WSO2Telco/analytics-hub/pull/233"},"issue":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/issues/233"},"comments":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/issues/233/comments"},"review_comments":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233/comments"},"review_comment":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/pulls/233/commits"},"statuses":{"href":"https://api.github.com/repos/WSO2Telco/analytics-hub/statuses/e4e312d538e921b32e1fc707e114fbf5ef3cbc64"}},"author_association":"NONE"}}
{"actor":{"display_login":"TelcoGitHubBot"}}