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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: Using Java v17 doesn't show proper Appwrite Exception message #16

Closed
2 tasks done
Caryntjen opened this issue Jan 10, 2022 · 5 comments 路 Fixed by appwrite/sdk-generator#340
Closed
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@Caryntjen
Copy link

Caryntjen commented Jan 10, 2022

馃憻 Reproduction steps

When I try call createEnumAttribute from server when the collection exists I get a stacktrace error, similar things happen to Floats. (Integer, Boolean, URL and Email work; IP not tested)

For example:

database.createEnumAttribute(collectionId = "xxxxxx", key = "enumTest", elements = arrayListOf("OPTION"), required = false, default = "OPTION")

database.createFloatAttribute(collectionId = "xxxxxx", key = "floatTest", min = "0.00", required = false, default = "0.00")

馃憤 Expected behavior

Proper AppwriteException message (for the floats) when using Java v11
Exception in thread "main" io.appwrite.exceptions.AppwriteException: Invalid default: Value must be a valid float
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:110)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
at com.google.gson.Gson.fromJson(Gson.java:932)
at com.google.gson.Gson.fromJson(Gson.java:897)
at com.google.gson.Gson.fromJson(Gson.java:846)
at com.google.gson.Gson.fromJson(Gson.java:817)
at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:371)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

馃憥 Actual Behavior

Stacktrace for Enums, Floats:

Exception in thread "OkHttp Dispatcher" java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String java.lang.Throwable.detailMessage accessible: module java.base does not "opens java.lang" to unnamed module @6b0c2d26
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
	at com.google.gson.internal.reflect.UnsafeReflectionAccessor.makeAccessible(UnsafeReflectionAccessor.java:44)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:159)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
	at com.google.gson.Gson.getAdapter(Gson.java:458)
	at com.google.gson.Gson.fromJson(Gson.java:931)
	at com.google.gson.Gson.fromJson(Gson.java:897)
	at com.google.gson.Gson.fromJson(Gson.java:846)
	at com.google.gson.Gson.fromJson(Gson.java:817)
	at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:371)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

馃幉 Appwrite version

Different version (specify in environment)

馃捇 Operating system

Windows

馃П Your Environment

  • appwrite 0.12.1
  • io.appwrite:sdk-for-kotlin:0.2.2

other dependencies:
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.10'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'
implementation "io.appwrite:sdk-for-kotlin:0.2.2"
implementation "com.sun.xml.bind:jaxb-impl:3.0.2"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2'
implementation "org.apache.logging.log4j:log4j-api-kotlin:1.1.0"
implementation 'org.apache.logging.log4j:log4j-api:2.17.1'
implementation 'org.apache.logging.log4j:log4j-core:2.17.1'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1"

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@Caryntjen Caryntjen added the bug Something isn't working label Jan 10, 2022
@Caryntjen Caryntjen changed the title 馃悰 Bug Report: StackTrace errors when creating attirbutes 馃悰 Bug Report: StackTrace errors when creating attributes Jan 10, 2022
@Caryntjen Caryntjen changed the title 馃悰 Bug Report: StackTrace errors when creating attributes 馃悰 Bug Report: StackTrace errors when creating Enum and Float attributes Jan 10, 2022
@Caryntjen
Copy link
Author

Caryntjen commented Jan 16, 2022

I updated the original ticket to reflect this information by removing that information that this not longer relevant.

@abnegate Just to make it clear as I could test v0.2.2. The String error was fixed but the Enum and Float errors are not. Hopefully you find a solution.

@Caryntjen
Copy link
Author

Caryntjen commented Jan 16, 2022

@abnegate I have encounterted the same error when trying to create Team Memberships.

So lets say I have created a team with the follow id: MY_TEAM and I want to add a team membership through the server.

     val membership = appwriteTeams.createMembership(
            teamId = "MY_TEAM",
            email = "user@test.com",
            roles = listOf("user"),
            url = "http://localhost/",
            name = "TEST USER"
        )

I do get the same error:

Exception in thread "OkHttp Dispatcher" java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String java.lang.Throwable.detailMessage accessible: module java.base does not "opens java.lang" to unnamed module @382db087
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
	at com.google.gson.internal.reflect.UnsafeReflectionAccessor.makeAccessible(UnsafeReflectionAccessor.java:44)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:159)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
	at com.google.gson.Gson.getAdapter(Gson.java:458)
	at com.google.gson.Gson.fromJson(Gson.java:931)
	at com.google.gson.Gson.fromJson(Gson.java:897)
	at com.google.gson.Gson.fromJson(Gson.java:846)
	at com.google.gson.Gson.fromJson(Gson.java:817)
	at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:371)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

@Caryntjen
Copy link
Author

Caryntjen commented Jan 16, 2022

Okay the project had JAVA v17 and could not show the propper appwrite Exception, so I have lowered the JAVA API to v11 and it shows the proper error messages.

@Caryntjen Caryntjen changed the title 馃悰 Bug Report: StackTrace errors when creating Enum and Float attributes 馃悰 Bug Report: Using Java v17 doesn't show proper Appwrite Exception message Jan 16, 2022
@abnegate
Copy link
Contributor

@Caryntjen Thank you for the info! A fix is underway 馃榿

@Caryntjen
Copy link
Author

Caryntjen commented Jan 21, 2022

@abnegate thank you. I am eagerly awaiting the fixes because they are blocking my project.

I saw a snapshot release with the fixes in: https://github.com/appwrite/sdk-for-kotlin/releases/tag/0.2.4-SNAPSHOT

Is that suppose to be in Maven Central repo because it seems like it is not?

https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants