Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrary ClassCastExceptions when using git-plugin (ChangeSet) #12

Open
Phleb4s opened this issue Nov 19, 2014 · 4 comments
Open

Arbitrary ClassCastExceptions when using git-plugin (ChangeSet) #12

Phleb4s opened this issue Nov 19, 2014 · 4 comments

Comments

@Phleb4s
Copy link

Phleb4s commented Nov 19, 2014

I am using the hudson.plugins.cloneworkspace.CloneWorkspaceSCM plugin and my builds often fail due to a ClassCastException:

java.lang.ClassCastException: hudson.plugins.cloneworkspace.CloneWorkspaceSCM cannot be cast to hudson.plugins.git.GitSCM
    at     hudson.plugins.git.GitChangeSet.isCreateAccountBaseOnCommitterEmail(GitChangeSet.java:296)

The following patch would fix that issue:

-    if (parent != null) {
+        if (parent != null && GitSCM.class.isAssignableFrom(parent.getBuild().getProject().getScm().getClass())) {
         createAccountBaseOnCommitterEmail = ((GitSCM) parent.getBuild().getProject().getScm()).
             isCreateAccountBaseOnCommitterEmail();
        }
@bobfoster
Copy link
Member

I guess the question is, why is the code trying to cast one SCM to another?

@wjprakash
Copy link
Member

Hudson by default supports only one SCM. But using plugin you could have multiple SCM. I'm not sure if that is the issue.

@Phleb4s
Copy link
Author

Phleb4s commented Nov 20, 2014

Of course that is the main question, why is Hudson trying to generate a changeset from the Git Plugin in the first place when the Job itself does use another SCM, e.g: CloneWorkspace. Maybe because the cloned workspace does look like a git repo, that is just my suggestion.
The strangest thing to me is that the error does only occur sometimes/most of the time but NOT always.

I have no experience in developing Hudson plugins however, so the suggested fix would simply prevent failing builds without going too deep into the cause.

@wjprakash
Copy link
Member

I see. This fix seems good to me. Finding exactly why change-set generation is called on Git rather than configured SCM would be even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants