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

NullPointerException bitBucketServer #213

Open
vchernyshov opened this issue Apr 9, 2022 · 7 comments
Open

NullPointerException bitBucketServer #213

vchernyshov opened this issue Apr 9, 2022 · 7 comments

Comments

@vchernyshov
Copy link

I'm getting this error:

java.lang.NullPointerException

        at systems.danger.kotlin.models.danger.DangerDSL.getBitBucketServer(DangerDSL.kt:27)
        at Dangerfile_df.<init>(Dangerfile.df.kts:9)

This is my danger file:

@file:Repository("https://repo.maven.apache.org")
@file:DependsOn("org.apache.commons:commons-text:1.6")

import org.apache.commons.text.WordUtils
import systems.danger.kotlin.*
import systems.danger.kotlin.models.danger.DangerDSL

danger(args) {
    if (bitBucketServer.pullRequest.title.contains("WIP", false)) {
        warn("PR is classed as Work in Progress")
    }
}

Any ideas why it could happen?

@f-meloni
Copy link
Member

f-meloni commented Apr 9, 2022

It seems that the bitBucketServer object in your DSL is null.

What is the output of danger-kotlin pr $YOUR_PR_LINK --json?

@vchernyshov
Copy link
Author

vchernyshov commented Apr 10, 2022

@f-meloni here is the json structure:
Screenshot 2022-04-10 at 09 04 14

according to source code _bitBucketServer is serialised with key bitbucket_server so looks like danger-kotlin doesn't support bitbucket_cloud

@f-meloni
Copy link
Member

Yes, it should be simple to fix that, but it seems that Danger Kotlin is not supporting bitbucket_cloud at the moment, let me see what I can do to fix it

@vchernyshov
Copy link
Author

@f-meloni it's simple but time consuming, bitbucket_cloud has different API response so it's not possible just to add new property to Danger with bitbucket_cloud, I had to modify several DTOs to make it work. Currently it's enough for me to test Danger-Kotlin, if it will cover all our needs we age going to add support of bitbucket_cloud by ourself and create PR to Danger-Kotlin

@f-meloni
Copy link
Member

Yeah, Danger Swift has already that DSL built, so we might just try to copy it here https://github.com/danger/swift/blob/master/Sources/Danger/BitBucketCloud.swift

@vchernyshov
Copy link
Author

Thanks, it will help me.

@vchernyshov
Copy link
Author

@f-meloni I have checked cloud support for swift and looks like the models are outdated.
I have extra question: is it possible to use pull request model inside plugin?

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

2 participants