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 при попытке вызывать DocsService().docsGetUploadServer() #527

Open
KorotaevaVasilisa opened this issue Mar 5, 2023 · 1 comment

Comments

@KorotaevaVasilisa
Copy link

KorotaevaVasilisa commented Mar 5, 2023

Этапы воспроизведения:

  1. Авторизоваться
val authLauncher = VK.login(this) { result : VKAuthenticationResult ->
            when (result) {
                is VKAuthenticationResult.Success -> {
                    serverAddress()
                }
                is VKAuthenticationResult.Failed -> {
                    // User didn't pass authorization
                    println()
                }
            }
        }
        authLauncher.launch(arrayListOf(VKScope.DOCS))
  1. Вызов команды DocsService().docsGetUploadServer()
 private fun serverAddress(){
        VK.execute(DocsService().docsGetUploadServer(), object : VKApiCallback<BaseUploadServerDto>{
            override fun fail(error: Exception) {
                println()
            }

            override fun success(result: BaseUploadServerDto) {
                println()
            }
        })
    }
  1. При вызове команды DocsService().docsGetUploadServer() срабатывает NullPointerException
  2. Изучив код я нашла место возникновения ошибки это класс com.vk.api.sdk.VKApiManager метода executeWithExceptionAdjust
    vk_npe

VK SDK version: 4.0.1

@xgensoft
Copy link

xgensoft commented Apr 15, 2023

Воспроизводится у меня тоже, при исполнении этого кода в версии 4.0.1:

        VK.execute(WallService().wallPost(VK.getUserId(), message=message, attachments=attachmentsList),
            object: VKApiCallback<WallPostResponseDto> {
                override fun success(result: WallPostResponseDto) {
                }
                override fun fail(error: Exception) {
                }
            }
        )

происходит исключение, но команда отрабатывает, запись на стене появляется:

java.lang.NullPointerException
     at com.vk.api.sdk.VKApiManager.executeWithExceptionAdjust(VKApiManager.kt:154)
     at com.vk.api.sdk.VKApiManager.execute(VKApiManager.kt:104)
     at com.vk.api.sdk.requests.VKRequest.onExecute(VKRequest.kt:97)
     at com.vk.api.sdk.internal.ApiCommand.execute(ApiCommand.kt:46)
     at com.vk.api.sdk.VK.executeSync(VK.kt:184)
     at com.vk.api.sdk.VK.execute$lambda-3(VK.kt:196)
     at com.vk.api.sdk.VK.$r8$lambda$WhbU2zvvaEaGtR_hkXlKsQEbwJk(Unknown Source:0)
     at com.vk.api.sdk.VK$$ExternalSyntheticLambda1.run(Unknown Source:4)
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:929)

При откате на версию 3.5.1 все отрабатывает без исключений.

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
@xgensoft @KorotaevaVasilisa and others