Branch: refs/heads/master
  Home:   https://github.com/jenkinsci/subversion-plugin
  Commit: 4adfbde76167231d057f2f44e21f52cf53219c4c
      
https://github.com/jenkinsci/subversion-plugin/commit/4adfbde76167231d057f2f44e21f52cf53219c4c
  Author: Thomas de Grenier de Latour <[email protected]>
  Date:   2015-08-28 (Fri, 28 Aug 2015)

  Changed paths:
    M src/main/java/hudson/scm/SubversionSCM.java

  Log Message:
  -----------
  Fix ClassCastException when migrating credentials

During some migrations from 1.x to 2.5, I've seen the following stack trace:

```
SEVERE: Failed SubversionSCM.perJobCredentialsMigration
java.lang.Error: java.lang.reflect.InvocationTargetException
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:109)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:903)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:105)
        ... 8 more
Caused by: java.lang.ClassCastException: hudson.plugins.git.GitSCM cannot be 
cast to hudson.scm.SubversionSCM
        at 
hudson.scm.PerJobCredentialStore.migrateCredentials(PerJobCredentialStore.java:120)
        at 
hudson.scm.SubversionSCM$DescriptorImpl.migratePerJobCredentials(SubversionSCM.java:1651)
        at 
hudson.scm.SubversionSCM.perJobCredentialsMigration(SubversionSCM.java:1582)
        ... 13 more
```

My understanding is that:

- `SubversionSCM.migratePerJobCredentials()` tries to migrate any job for which 
a `subversion.credentials` file was found
- `PerJobCredentialStore.migrateCredentials()` assumes that the job to migrate 
is actually using SVN (ie., that `getScm()` will return a `SubversionSCM` 
object)
- if a job used to have a Subversion repository configured, then a 
`subversion.credentials` file will be found, but `migrateCredentials()` will 
fail with `ClassCastException`

The proposed fix simply avoids calling the migration process on such jobs.
The obsolete `subversion.credentials` files found in such jobs will still be 
deleted, but not converted into new-style Credentials.


  Commit: 606d95849828e2294fa372ddf9be6e0f90e5cb48
      
https://github.com/jenkinsci/subversion-plugin/commit/606d95849828e2294fa372ddf9be6e0f90e5cb48
  Author: Manuel Recena <[email protected]>
  Date:   2015-08-29 (Sat, 29 Aug 2015)

  Changed paths:
    M src/main/java/hudson/scm/SubversionSCM.java

  Log Message:
  -----------
  Merge pull request #135 from 
thomasgl-orange/fix-migrateCredentials-ClassCastException

[JENKINS-30197] ClassCastException when migrating credentials


Compare: 
https://github.com/jenkinsci/subversion-plugin/compare/ab24371826eb...606d95849828

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to