ENT-12276: Exception now takes a string not a Method object, which wa… (#7834)

* ENT-12276: Exception now takes a string not a Method object, which was causing problems in Jackson parsing.
This commit is contained in:
Adel El-Beik 2024-10-04 11:32:20 +01:00 committed by GitHub
parent 088846f428
commit babaceab5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,6 @@ import org.objectweb.asm.Opcodes.*
import org.objectweb.asm.Type
import java.lang.Character.isJavaIdentifierPart
import java.lang.Character.isJavaIdentifierStart
import java.lang.reflect.Method
/**
* Any object that implements this interface is expected to expose its own fields via the [get] method, exactly
@ -44,8 +43,8 @@ class CarpenterClassLoader(private val parentClassLoader: ClassLoader = Thread.c
}
}
class InterfaceMismatchNonGetterException(val clazz: Class<*>, val method: Method) : InterfaceMismatchException(
"Requested interfaces must consist only of methods that start with 'get': ${clazz.name}.${method.name}")
class InterfaceMismatchNonGetterException(val clazz: Class<*>, val methodName: String) : InterfaceMismatchException(
"Requested interfaces must consist only of methods that start with 'get': ${clazz.name}.${methodName}")
class InterfaceMismatchMissingAMQPFieldException(val clazz: Class<*>, val field: String) : InterfaceMismatchException(
"Interface ${clazz.name} requires a field named $field but that isn't found in the schema or any superclass schemas")
@ -459,7 +458,7 @@ class ClassCarpenterImpl @JvmOverloads constructor (override val whitelist: Clas
logger.debug { "Ignoring interface $method which is not a getter" }
continue@methodLoop
} else {
throw InterfaceMismatchNonGetterException(itf, method)
throw InterfaceMismatchNonGetterException(itf, method.name)
}
// If we're trying to carpent a class that prior to serialisation / deserialization