googleapis / googleapis/google-api-java-client

Data.isNull return invalid true after proguard

Ouverte
#2,603 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
priority: p3 type: bug
Langage dominant
Java
Étoiles
1.5k
Forks
772
Merge moyen
1 h 44 min
PR mergées (30 j)
1

Description

#### Environment details

1. Kotlin Multiplatform Project
2. Compose Multiplatform
3. Youtube API

#### Steps to reproduce

1. Configure Youtube API
2. Create request a videos list using setMine(true)
3. Apply proguard/r8
4. Get error

#### Code example

```java
// example
```

#### Stack trace
```

Field: mine , value: true, isNull: true
Field: part, value [contentDetails], isNull: false

Generated URL: https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails

Exception in thread "AWT-EventQueue-0" com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
GET https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails
{
"code": 400,
"errors": [
{
"domain": "youtube.parameter",
"location": "parameters.",
"locationType": "other",
"message": "No filter selected. Expected one of: mySubscribers, forUsername, forHandle, categoryId, id, mine, managedByMe",
"reason": "missingRequiredParameter"
}
],
"message": "No filter selected. Expected one of: mySubscribers, forUsername, forHandle, categoryId, id, mine, managedByMe"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:118)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:37)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$3.interceptResponse(AbstractGoogleClientRequest.java:479)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1111)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:565)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:506)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:616)
at org.malv.youtube.services.YoutubeService$getVideos$2.invokeSuspend(YoutubeService.kt:49)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:1820)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@38fc853c, Dispatchers.Main.immediate]

```

#### External references such as API reference guides

isNull method

```
public static boolean isNull(Object object) { // don't call nullOf because will throw IllegalArgumentException if cannot create instance
return object != null && object == NULL_CACHE.get(object.getClass());
}
```

#### Any additional information below

I think the problem is that, after ProGuard, Boolean object is converted to primitives, so, "true" are the same object in NULL_CACHE and it return isNull. If the value is "false" return that is not null.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.