{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/comments/38193434","id":38193434,"diff_hunk":"@@ -1667,8 +1667,10 @@ public void load() {\n                 File jobCredentials = new File(job.getRootDir(), \"subversion.credentials\");","path":"src/main/java/hudson/scm/SubversionSCM.java","position":1,"original_position":1,"commit_id":"4adfbde76167231d057f2f44e21f52cf53219c4c","original_commit_id":"4adfbde76167231d057f2f44e21f52cf53219c4c","user":{"login":"thomasgl-orange","id":6212720,"avatar_url":"https://avatars.githubusercontent.com/u/6212720?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasgl-orange","html_url":"https://github.com/thomasgl-orange","followers_url":"https://api.github.com/users/thomasgl-orange/followers","following_url":"https://api.github.com/users/thomasgl-orange/following{/other_user}","gists_url":"https://api.github.com/users/thomasgl-orange/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasgl-orange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasgl-orange/subscriptions","organizations_url":"https://api.github.com/users/thomasgl-orange/orgs","repos_url":"https://api.github.com/users/thomasgl-orange/repos","events_url":"https://api.github.com/users/thomasgl-orange/events{/privacy}","received_events_url":"https://api.github.com/users/thomasgl-orange/received_events","type":"User","site_admin":false},"body":"I can't tell exactly how/why it happened, but I've found a few such jobs (with GitSCM in their `config.xml`, but still having a `subversion.credentials` file on-disk), on some of the Jenkins instances I manage.  My assumption was that it is some left-overs after projects moving from SVN to Git, and changing SCM config of their jobs.","created_at":"2015-08-28T12:12:43Z","updated_at":"2015-08-28T12:12:43Z","html_url":"https://github.com/jenkinsci/subversion-plugin/pull/135#discussion_r38193434","pull_request_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/comments/38193434"},"html":{"href":"https://github.com/jenkinsci/subversion-plugin/pull/135#discussion_r38193434"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135","id":43613996,"html_url":"https://github.com/jenkinsci/subversion-plugin/pull/135","diff_url":"https://github.com/jenkinsci/subversion-plugin/pull/135.diff","patch_url":"https://github.com/jenkinsci/subversion-plugin/pull/135.patch","issue_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/issues/135","number":135,"state":"open","locked":false,"title":"Fix ClassCastException when migrating credentials","user":{"login":"thomasgl-orange","id":6212720,"avatar_url":"https://avatars.githubusercontent.com/u/6212720?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasgl-orange","html_url":"https://github.com/thomasgl-orange","followers_url":"https://api.github.com/users/thomasgl-orange/followers","following_url":"https://api.github.com/users/thomasgl-orange/following{/other_user}","gists_url":"https://api.github.com/users/thomasgl-orange/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasgl-orange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasgl-orange/subscriptions","organizations_url":"https://api.github.com/users/thomasgl-orange/orgs","repos_url":"https://api.github.com/users/thomasgl-orange/repos","events_url":"https://api.github.com/users/thomasgl-orange/events{/privacy}","received_events_url":"https://api.github.com/users/thomasgl-orange/received_events","type":"User","site_admin":false},"body":"During some migrations from 1.x to 2.5, I've seen the following stack trace:\r\n\r\n```\r\nSEVERE: Failed SubversionSCM.perJobCredentialsMigration\r\njava.lang.Error: java.lang.reflect.InvocationTargetException\r\n\tat hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:109)\r\n\tat hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:169)\r\n\tat org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)\r\n\tat jenkins.model.Jenkins$7.runTask(Jenkins.java:903)\r\n\tat org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)\r\n\tat org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: java.lang.reflect.InvocationTargetException\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n\tat hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:105)\r\n\t... 8 more\r\nCaused by: java.lang.ClassCastException: hudson.plugins.git.GitSCM cannot be cast to hudson.scm.SubversionSCM\r\n\tat hudson.scm.PerJobCredentialStore.migrateCredentials(PerJobCredentialStore.java:120)\r\n\tat hudson.scm.SubversionSCM$DescriptorImpl.migratePerJobCredentials(SubversionSCM.java:1651)\r\n\tat hudson.scm.SubversionSCM.perJobCredentialsMigration(SubversionSCM.java:1582)\r\n\t... 13 more\r\n```\r\n\r\nMy understanding is that:\r\n\r\n- `SubversionSCM.migratePerJobCredentials()` tries to migrate any job for which a `subversion.credentials` file was found\r\n- `PerJobCredentialStore.migrateCredentials()` assumes that the job to migrate is actually using SVN (ie., that `getScm()` will return a `SubversionSCM` object)\r\n- if a job used to have a Subversion repository configured, then a `subversion.credentials` file will be found, but `migrateCredentials()` will fail with `ClassCastException`\r\n\r\nThe proposed fix simply avoids calling the migration process on such jobs.\r\nThe obsolete `subversion.credentials` files found in such jobs will still be deleted, but not converted into new-style Credentials.","created_at":"2015-08-28T10:26:41Z","updated_at":"2015-08-28T12:12:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eeeb073167a3ca040ca489fdd483c3663d364441","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/issues/135/comments","statuses_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/statuses/4adfbde76167231d057f2f44e21f52cf53219c4c","head":{"label":"thomasgl-orange:fix-migrateCredentials-ClassCastException","ref":"fix-migrateCredentials-ClassCastException","sha":"4adfbde76167231d057f2f44e21f52cf53219c4c","user":{"login":"thomasgl-orange","id":6212720,"avatar_url":"https://avatars.githubusercontent.com/u/6212720?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasgl-orange","html_url":"https://github.com/thomasgl-orange","followers_url":"https://api.github.com/users/thomasgl-orange/followers","following_url":"https://api.github.com/users/thomasgl-orange/following{/other_user}","gists_url":"https://api.github.com/users/thomasgl-orange/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasgl-orange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasgl-orange/subscriptions","organizations_url":"https://api.github.com/users/thomasgl-orange/orgs","repos_url":"https://api.github.com/users/thomasgl-orange/repos","events_url":"https://api.github.com/users/thomasgl-orange/events{/privacy}","received_events_url":"https://api.github.com/users/thomasgl-orange/received_events","type":"User","site_admin":false},"repo":{"id":41539574,"name":"subversion-plugin","full_name":"thomasgl-orange/subversion-plugin","owner":{"login":"thomasgl-orange","id":6212720,"avatar_url":"https://avatars.githubusercontent.com/u/6212720?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasgl-orange","html_url":"https://github.com/thomasgl-orange","followers_url":"https://api.github.com/users/thomasgl-orange/followers","following_url":"https://api.github.com/users/thomasgl-orange/following{/other_user}","gists_url":"https://api.github.com/users/thomasgl-orange/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasgl-orange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasgl-orange/subscriptions","organizations_url":"https://api.github.com/users/thomasgl-orange/orgs","repos_url":"https://api.github.com/users/thomasgl-orange/repos","events_url":"https://api.github.com/users/thomasgl-orange/events{/privacy}","received_events_url":"https://api.github.com/users/thomasgl-orange/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thomasgl-orange/subversion-plugin","description":"Jenkins subversion plugin","fork":true,"url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin","forks_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/forks","keys_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/teams","hooks_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/hooks","issue_events_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/events","assignees_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/tags","blobs_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/languages","stargazers_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/stargazers","contributors_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/contributors","subscribers_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/subscribers","subscription_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/subscription","commits_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/merges","archive_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/downloads","issues_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/labels{/name}","releases_url":"https://api.github.com/repos/thomasgl-orange/subversion-plugin/releases{/id}","created_at":"2015-08-28T09:43:25Z","updated_at":"2015-08-28T09:43:26Z","pushed_at":"2015-08-28T10:25:19Z","git_url":"git://github.com/thomasgl-orange/subversion-plugin.git","ssh_url":"git@github.com:thomasgl-orange/subversion-plugin.git","clone_url":"https://github.com/thomasgl-orange/subversion-plugin.git","svn_url":"https://github.com/thomasgl-orange/subversion-plugin","homepage":"http://jenkins-ci.org/","size":6800,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"ab24371826ebc649cdc853b9c0c5047e96642543","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":1163422,"name":"subversion-plugin","full_name":"jenkinsci/subversion-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/subversion-plugin","description":"Jenkins subversion plugin","fork":false,"url":"https://api.github.com/repos/jenkinsci/subversion-plugin","forks_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/subversion-plugin/releases{/id}","created_at":"2010-12-13T05:24:54Z","updated_at":"2015-07-19T11:14:36Z","pushed_at":"2015-08-28T10:26:41Z","git_url":"git://github.com/jenkinsci/subversion-plugin.git","ssh_url":"git@github.com:jenkinsci/subversion-plugin.git","clone_url":"https://github.com/jenkinsci/subversion-plugin.git","svn_url":"https://github.com/jenkinsci/subversion-plugin","homepage":"http://jenkins-ci.org/","size":6800,"stargazers_count":70,"watchers_count":70,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":142,"mirror_url":null,"open_issues_count":21,"forks":142,"open_issues":21,"watchers":70,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135"},"html":{"href":"https://github.com/jenkinsci/subversion-plugin/pull/135"},"issue":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/issues/135"},"comments":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/subversion-plugin/statuses/4adfbde76167231d057f2f44e21f52cf53219c4c"}}}}