[ https://issues.apache.org/jira/browse/AVRO-4078 ]
prashant sharma deleted comment on AVRO-4078:
---------------------------------------
was (Author: JIRAUSER307403):
Please note that in our project the avro schema files are generated into java
classes using java8 and the test uses java 11.
> RecursiveUpdate error when calling
> -----------------------------------
>
> Key: AVRO-4078
> URL: https://issues.apache.org/jira/browse/AVRO-4078
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.11.3
> Environment: java version 11
> avro version 1.11.4 and 1.11.3
>
> Reporter: prashant sharma
> Priority: Blocker
>
> I think there is an issue in avro versions (1.10+) onwards caused by MapUtil
> class
> ([https://github.com/apache/avro/blob/main/lang/java/avro/src/main/java/org/apache/avro/util/MapUtil.java])
>
> package com.tesco.identity.riskengine.blocking.ip
> import org.apache.avro.Schema
> import org.apache.avro.specific.SpecificData
> import spock.lang.Specification
> class DemoTest extends Specification {
> public static final Schema IDENTIFICATION_SCHEMA$ = (new
> Schema.Parser()).parse("{\n" +
> " \"type\": \"record\",\n" +
> " \"namespace\": \"com.tesco.identity.auth.session\",\n" +
> " \"name\": \"IdentificationResult\",\n" +
> " \"fields\": [\n" +
> "
> {\n" + " \"name\": \"something\",\n" + " \"type\": \"string\"\n" + " }
> \n" +
> " ]\n" +
> "}");
> def "test class load"()
> { given: when: "specific data static method is called to load schema"
> SpecificData.get().getClass(IDENTIFICATION_SCHEMA$) then: "no exception is
> thrown" noExceptionThrown() }
> }
>
> This is the stacktrace
>
> Expected no exception to be thrown, but got
> 'java.lang.ExceptionInInitializerError'
>
> at spock.lang.Specification.noExceptionThrown(Specification.java:118)
> at com.tesco.identity.riskengine.blocking.ip.DemoTest.test class
> load(DemoTest.groovy:39)
> Caused by: java.lang.ExceptionInInitializerError
> at java.base/java.lang.Class.forName(Class.java:398)
> at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:95)
> at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:72)
> at
> org.apache.avro.specific.SpecificData.lambda$getClass$2(SpecificData.java:259)
> at
> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
> at org.apache.avro.util.MapUtil.computeIfAbsent(MapUtil.java:42)
> at org.apache.avro.specific.SpecificData.getClass(SpecificData.java:257)
> at com.tesco.identity.riskengine.blocking.ip.DemoTest.test class
> load(DemoTest.groovy:36)
> Caused by: java.lang.IllegalStateException: Recursive update
> at
> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1760)
> at org.apache.avro.util.MapUtil.computeIfAbsent(MapUtil.java:42)
> at org.apache.avro.specific.SpecificData.getClass(SpecificData.java:257)
> at org.apache.avro.specific.SpecificData.getForSchema(SpecificData.java:164)
> at
> org.apache.avro.specific.SpecificDatumWriter.<init>(SpecificDatumWriter.java:47)
> at
> com.tesco.identity.auth.session.IdentificationResult.<clinit>(IdentificationResult.java:881)
> ... 8 more
>
> If I use avro version 1.9 (which doesn't have MapUtil) my test works.
>
>
> P.S - we are migrating our services(that uses kafka and avro schema) from 1.9
> to 1.11.4 as there has been a critical vulnerability reported in avro
> ([https://security.snyk.io/vuln/SNYK-JAVA-ORGAPACHEAVRO-8161188]) , But we
> can't do it as avro 1.11.* fails for us due to above issue.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)