func checkAndGetException()

in java_unknown_exception.go [31:58]


func checkAndGetException(cls *ClassInfo) (*structInfo, bool) {
	if len(cls.fieldNameList) < 4 {
		return nil, false
	}
	var (
		throwable *structInfo
		ok        bool
	)
	count := 0
	for _, item := range cls.fieldNameList {
		if item == "detailMessage" || item == "suppressedExceptions" || item == "stackTrace" || item == "cause" {
			count++
		}
	}
	// if have these 4 fields, it is throwable struct
	if count == 4 {
		exceptionCheckMutex.Lock()
		defer exceptionCheckMutex.Unlock()
		if throwable, ok = getStructInfo(cls.javaName); ok {
			return throwable, true
		}
		RegisterPOJO(newBizException(cls.javaName))
		if throwable, ok = getStructInfo(cls.javaName); ok {
			return throwable, true
		}
	}
	return throwable, count == 4
}