{"action":"created","comment":{"url":"https://api.github.com/repos/JabRef/jabref/pulls/comments/60625402","id":60625402,"diff_hunk":"@@ -170,36 +155,38 @@ private int populateEntryGroupsTable(GroupTreeNode cursor, int parentID, int cur\n         if (cursor.getGroup() instanceof ExplicitGroup) {\n             ExplicitGroup grp = (ExplicitGroup) cursor.getGroup();\n             for (BibEntry be : grp.getEntries()) {\n-                SQLUtil.processQuery(out, \"INSERT INTO entry_group (entries_id, groups_id) \" + \"VALUES (\"\n+                SQLUtil.processQuery(connection, \"INSERT INTO entry_group (entries_id, groups_id) \" + \"VALUES (\"\n                         + \"(SELECT entries_id FROM entries WHERE jabref_eid=\" + '\\'' + be.getId()\n                         + \"' AND database_id = \" + database_id + \"), \"\n                         + \"(SELECT groups_id FROM groups WHERE database_id=\" + '\\'' + database_id + \"' AND parent_id=\"\n                         + '\\'' + parentID + \"' AND label=\" + '\\'' + grp.getName() + \"')\" + \");\");\n             }\n         }\n \n-        if(out instanceof Connection) {\n+        // recurse on child nodes (depth-first traversal)\n+        String sql = \"SELECT groups_id FROM groups WHERE label = ? AND database_id= ? AND parent_id = ? ;\";\n+        try (PreparedStatement statement = connection.prepareStatement(sql)) {\n+\n+            statement.setString(1, cursor.getGroup().getName());\n+            statement.setInt(2, database_id);\n+            statement.setInt(3, parentID);\n+            try (ResultSet resultSet = statement.executeQuery()) {\n \n-            // recurse on child nodes (depth-first traversal)\n-            String query = \"SELECT groups_id FROM groups WHERE label='\" + cursor.getGroup().getName() + \"' AND database_id='\"\n-                    + database_id + \"' AND parent_id='\" + parentID + \"';\";\n-            try (Statement statement = ((Connection) out).createStatement();\n-                ResultSet resultSet = statement.executeQuery(query)) {\n                 // setting values to ID and myID to be used in case of textual SQL\n                 // export\n-                ++currentID;\n+                currentID++;\n                 int myID = currentID;\n                 resultSet.next();\n                 myID = resultSet.getInt(\"groups_id\");\n \n                 for (GroupTreeNode child : cursor.getChildren()) {\n-                    currentID = populateEntryGroupsTable(child, myID, currentID, out, database_id);\n+                    currentID = populateEntryGroupsTable(child, myID, currentID, connection, database_id);\n                 }\n-                //Unfortunatley, AutoCloseable throws only Exception\n-            } catch (Exception e) {\n-                LOGGER.warn(\"Cannot close resource\", e);\n-            }\n \n+            }\n+            //Unfortunatley, AutoCloseable throws only Exception","path":"src/main/java/net/sf/jabref/sql/exporter/DatabaseExporter.java","position":163,"original_position":163,"commit_id":"3ba5aca0cafe1eab94116c9fc428f7681b54882b","original_commit_id":"3ba5aca0cafe1eab94116c9fc428f7681b54882b","user":{"login":"stefan-kolb","id":2141507,"avatar_url":"https://avatars.githubusercontent.com/u/2141507?v=3","gravatar_id":"","url":"https://api.github.com/users/stefan-kolb","html_url":"https://github.com/stefan-kolb","followers_url":"https://api.github.com/users/stefan-kolb/followers","following_url":"https://api.github.com/users/stefan-kolb/following{/other_user}","gists_url":"https://api.github.com/users/stefan-kolb/gists{/gist_id}","starred_url":"https://api.github.com/users/stefan-kolb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefan-kolb/subscriptions","organizations_url":"https://api.github.com/users/stefan-kolb/orgs","repos_url":"https://api.github.com/users/stefan-kolb/repos","events_url":"https://api.github.com/users/stefan-kolb/events{/privacy}","received_events_url":"https://api.github.com/users/stefan-kolb/received_events","type":"User","site_admin":false},"body":"Remove comment","created_at":"2016-04-21T17:48:43Z","updated_at":"2016-04-21T17:48:43Z","html_url":"https://github.com/JabRef/jabref/pull/1269#discussion_r60625402","pull_request_url":"https://api.github.com/repos/JabRef/jabref/pulls/1269","_links":{"self":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/comments/60625402"},"html":{"href":"https://github.com/JabRef/jabref/pull/1269#discussion_r60625402"},"pull_request":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/1269"}}},"pull_request":{"url":"https://api.github.com/repos/JabRef/jabref/pulls/1269","id":67315914,"html_url":"https://github.com/JabRef/jabref/pull/1269","diff_url":"https://github.com/JabRef/jabref/pull/1269.diff","patch_url":"https://github.com/JabRef/jabref/pull/1269.patch","issue_url":"https://api.github.com/repos/JabRef/jabref/issues/1269","number":1269,"state":"open","locked":false,"title":"Create tests to fix #473","user":{"login":"simonharrer","id":375693,"avatar_url":"https://avatars.githubusercontent.com/u/375693?v=3","gravatar_id":"","url":"https://api.github.com/users/simonharrer","html_url":"https://github.com/simonharrer","followers_url":"https://api.github.com/users/simonharrer/followers","following_url":"https://api.github.com/users/simonharrer/following{/other_user}","gists_url":"https://api.github.com/users/simonharrer/gists{/gist_id}","starred_url":"https://api.github.com/users/simonharrer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonharrer/subscriptions","organizations_url":"https://api.github.com/users/simonharrer/orgs","repos_url":"https://api.github.com/users/simonharrer/repos","events_url":"https://api.github.com/users/simonharrer/events{/privacy}","received_events_url":"https://api.github.com/users/simonharrer/received_events","type":"User","site_admin":false},"body":"- [x] Test which reproduces #473\r\n- [x] fix for #473\r\n\r\n","created_at":"2016-04-21T08:37:16Z","updated_at":"2016-04-21T17:48:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9565e81b2e028f34fb70b23d5717ed0c3c3aa2b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JabRef/jabref/pulls/1269/commits","review_comments_url":"https://api.github.com/repos/JabRef/jabref/pulls/1269/comments","review_comment_url":"https://api.github.com/repos/JabRef/jabref/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JabRef/jabref/issues/1269/comments","statuses_url":"https://api.github.com/repos/JabRef/jabref/statuses/3ba5aca0cafe1eab94116c9fc428f7681b54882b","head":{"label":"JabRef:fix-473","ref":"fix-473","sha":"3ba5aca0cafe1eab94116c9fc428f7681b54882b","user":{"login":"JabRef","id":3914421,"avatar_url":"https://avatars.githubusercontent.com/u/3914421?v=3","gravatar_id":"","url":"https://api.github.com/users/JabRef","html_url":"https://github.com/JabRef","followers_url":"https://api.github.com/users/JabRef/followers","following_url":"https://api.github.com/users/JabRef/following{/other_user}","gists_url":"https://api.github.com/users/JabRef/gists{/gist_id}","starred_url":"https://api.github.com/users/JabRef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JabRef/subscriptions","organizations_url":"https://api.github.com/users/JabRef/orgs","repos_url":"https://api.github.com/users/JabRef/repos","events_url":"https://api.github.com/users/JabRef/events{/privacy}","received_events_url":"https://api.github.com/users/JabRef/received_events","type":"Organization","site_admin":false},"repo":{"id":17634071,"name":"jabref","full_name":"JabRef/jabref","owner":{"login":"JabRef","id":3914421,"avatar_url":"https://avatars.githubusercontent.com/u/3914421?v=3","gravatar_id":"","url":"https://api.github.com/users/JabRef","html_url":"https://github.com/JabRef","followers_url":"https://api.github.com/users/JabRef/followers","following_url":"https://api.github.com/users/JabRef/following{/other_user}","gists_url":"https://api.github.com/users/JabRef/gists{/gist_id}","starred_url":"https://api.github.com/users/JabRef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JabRef/subscriptions","organizations_url":"https://api.github.com/users/JabRef/orgs","repos_url":"https://api.github.com/users/JabRef/repos","events_url":"https://api.github.com/users/JabRef/events{/privacy}","received_events_url":"https://api.github.com/users/JabRef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JabRef/jabref","description":"Graphical Java application for managing bibtex (.bib) databases","fork":false,"url":"https://api.github.com/repos/JabRef/jabref","forks_url":"https://api.github.com/repos/JabRef/jabref/forks","keys_url":"https://api.github.com/repos/JabRef/jabref/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JabRef/jabref/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JabRef/jabref/teams","hooks_url":"https://api.github.com/repos/JabRef/jabref/hooks","issue_events_url":"https://api.github.com/repos/JabRef/jabref/issues/events{/number}","events_url":"https://api.github.com/repos/JabRef/jabref/events","assignees_url":"https://api.github.com/repos/JabRef/jabref/assignees{/user}","branches_url":"https://api.github.com/repos/JabRef/jabref/branches{/branch}","tags_url":"https://api.github.com/repos/JabRef/jabref/tags","blobs_url":"https://api.github.com/repos/JabRef/jabref/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JabRef/jabref/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JabRef/jabref/git/refs{/sha}","trees_url":"https://api.github.com/repos/JabRef/jabref/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JabRef/jabref/statuses/{sha}","languages_url":"https://api.github.com/repos/JabRef/jabref/languages","stargazers_url":"https://api.github.com/repos/JabRef/jabref/stargazers","contributors_url":"https://api.github.com/repos/JabRef/jabref/contributors","subscribers_url":"https://api.github.com/repos/JabRef/jabref/subscribers","subscription_url":"https://api.github.com/repos/JabRef/jabref/subscription","commits_url":"https://api.github.com/repos/JabRef/jabref/commits{/sha}","git_commits_url":"https://api.github.com/repos/JabRef/jabref/git/commits{/sha}","comments_url":"https://api.github.com/repos/JabRef/jabref/comments{/number}","issue_comment_url":"https://api.github.com/repos/JabRef/jabref/issues/comments{/number}","contents_url":"https://api.github.com/repos/JabRef/jabref/contents/{+path}","compare_url":"https://api.github.com/repos/JabRef/jabref/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JabRef/jabref/merges","archive_url":"https://api.github.com/repos/JabRef/jabref/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JabRef/jabref/downloads","issues_url":"https://api.github.com/repos/JabRef/jabref/issues{/number}","pulls_url":"https://api.github.com/repos/JabRef/jabref/pulls{/number}","milestones_url":"https://api.github.com/repos/JabRef/jabref/milestones{/number}","notifications_url":"https://api.github.com/repos/JabRef/jabref/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JabRef/jabref/labels{/name}","releases_url":"https://api.github.com/repos/JabRef/jabref/releases{/id}","deployments_url":"https://api.github.com/repos/JabRef/jabref/deployments","created_at":"2014-03-11T14:48:42Z","updated_at":"2016-04-20T15:16:02Z","pushed_at":"2016-04-21T17:44:31Z","git_url":"git://github.com/JabRef/jabref.git","ssh_url":"git@github.com:JabRef/jabref.git","clone_url":"https://github.com/JabRef/jabref.git","svn_url":"https://github.com/JabRef/jabref","homepage":"http://www.jabref.org/","size":83248,"stargazers_count":265,"watchers_count":265,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":185,"mirror_url":null,"open_issues_count":193,"forks":185,"open_issues":193,"watchers":265,"default_branch":"master"}},"base":{"label":"JabRef:master","ref":"master","sha":"3f160e8041f9b78dc774dd42bde56bf98fd11f1f","user":{"login":"JabRef","id":3914421,"avatar_url":"https://avatars.githubusercontent.com/u/3914421?v=3","gravatar_id":"","url":"https://api.github.com/users/JabRef","html_url":"https://github.com/JabRef","followers_url":"https://api.github.com/users/JabRef/followers","following_url":"https://api.github.com/users/JabRef/following{/other_user}","gists_url":"https://api.github.com/users/JabRef/gists{/gist_id}","starred_url":"https://api.github.com/users/JabRef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JabRef/subscriptions","organizations_url":"https://api.github.com/users/JabRef/orgs","repos_url":"https://api.github.com/users/JabRef/repos","events_url":"https://api.github.com/users/JabRef/events{/privacy}","received_events_url":"https://api.github.com/users/JabRef/received_events","type":"Organization","site_admin":false},"repo":{"id":17634071,"name":"jabref","full_name":"JabRef/jabref","owner":{"login":"JabRef","id":3914421,"avatar_url":"https://avatars.githubusercontent.com/u/3914421?v=3","gravatar_id":"","url":"https://api.github.com/users/JabRef","html_url":"https://github.com/JabRef","followers_url":"https://api.github.com/users/JabRef/followers","following_url":"https://api.github.com/users/JabRef/following{/other_user}","gists_url":"https://api.github.com/users/JabRef/gists{/gist_id}","starred_url":"https://api.github.com/users/JabRef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JabRef/subscriptions","organizations_url":"https://api.github.com/users/JabRef/orgs","repos_url":"https://api.github.com/users/JabRef/repos","events_url":"https://api.github.com/users/JabRef/events{/privacy}","received_events_url":"https://api.github.com/users/JabRef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JabRef/jabref","description":"Graphical Java application for managing bibtex (.bib) databases","fork":false,"url":"https://api.github.com/repos/JabRef/jabref","forks_url":"https://api.github.com/repos/JabRef/jabref/forks","keys_url":"https://api.github.com/repos/JabRef/jabref/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JabRef/jabref/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JabRef/jabref/teams","hooks_url":"https://api.github.com/repos/JabRef/jabref/hooks","issue_events_url":"https://api.github.com/repos/JabRef/jabref/issues/events{/number}","events_url":"https://api.github.com/repos/JabRef/jabref/events","assignees_url":"https://api.github.com/repos/JabRef/jabref/assignees{/user}","branches_url":"https://api.github.com/repos/JabRef/jabref/branches{/branch}","tags_url":"https://api.github.com/repos/JabRef/jabref/tags","blobs_url":"https://api.github.com/repos/JabRef/jabref/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JabRef/jabref/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JabRef/jabref/git/refs{/sha}","trees_url":"https://api.github.com/repos/JabRef/jabref/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JabRef/jabref/statuses/{sha}","languages_url":"https://api.github.com/repos/JabRef/jabref/languages","stargazers_url":"https://api.github.com/repos/JabRef/jabref/stargazers","contributors_url":"https://api.github.com/repos/JabRef/jabref/contributors","subscribers_url":"https://api.github.com/repos/JabRef/jabref/subscribers","subscription_url":"https://api.github.com/repos/JabRef/jabref/subscription","commits_url":"https://api.github.com/repos/JabRef/jabref/commits{/sha}","git_commits_url":"https://api.github.com/repos/JabRef/jabref/git/commits{/sha}","comments_url":"https://api.github.com/repos/JabRef/jabref/comments{/number}","issue_comment_url":"https://api.github.com/repos/JabRef/jabref/issues/comments{/number}","contents_url":"https://api.github.com/repos/JabRef/jabref/contents/{+path}","compare_url":"https://api.github.com/repos/JabRef/jabref/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JabRef/jabref/merges","archive_url":"https://api.github.com/repos/JabRef/jabref/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JabRef/jabref/downloads","issues_url":"https://api.github.com/repos/JabRef/jabref/issues{/number}","pulls_url":"https://api.github.com/repos/JabRef/jabref/pulls{/number}","milestones_url":"https://api.github.com/repos/JabRef/jabref/milestones{/number}","notifications_url":"https://api.github.com/repos/JabRef/jabref/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JabRef/jabref/labels{/name}","releases_url":"https://api.github.com/repos/JabRef/jabref/releases{/id}","deployments_url":"https://api.github.com/repos/JabRef/jabref/deployments","created_at":"2014-03-11T14:48:42Z","updated_at":"2016-04-20T15:16:02Z","pushed_at":"2016-04-21T17:44:31Z","git_url":"git://github.com/JabRef/jabref.git","ssh_url":"git@github.com:JabRef/jabref.git","clone_url":"https://github.com/JabRef/jabref.git","svn_url":"https://github.com/JabRef/jabref","homepage":"http://www.jabref.org/","size":83248,"stargazers_count":265,"watchers_count":265,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":185,"mirror_url":null,"open_issues_count":193,"forks":185,"open_issues":193,"watchers":265,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/1269"},"html":{"href":"https://github.com/JabRef/jabref/pull/1269"},"issue":{"href":"https://api.github.com/repos/JabRef/jabref/issues/1269"},"comments":{"href":"https://api.github.com/repos/JabRef/jabref/issues/1269/comments"},"review_comments":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/1269/comments"},"review_comment":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/1269/commits"},"statuses":{"href":"https://api.github.com/repos/JabRef/jabref/statuses/3ba5aca0cafe1eab94116c9fc428f7681b54882b"}}}}