[
https://issues.apache.org/jira/browse/AVRO-1442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13916038#comment-13916038
]
Jim Pivarski commented on AVRO-1442:
------------------------------------
Note: this bug affects per-instance schema resolution, but not per-schema
resolution. That is, reading in a fixed datum with the wrong schema throws the
wrong exception, but explicitly checking reader and writer schemae like this:
{code:java}
import org.apache.avro.SchemaCompatibility.checkReaderWriterCompatibility
import org.apache.avro.SchemaCompatibility.SchemaCompatibilityType
checkReaderWriterCompatibility(readerSchema, writerSchema).getType() ==
SchemaCompatibilityType.COMPATIBLE
{code}
does the right thing. If a schema test like this is done before reading any
data, then the user gets the right error message.
> Case "FIXED" not handled in ResolvingGrammarGenerator
> -----------------------------------------------------
>
> Key: AVRO-1442
> URL: https://issues.apache.org/jira/browse/AVRO-1442
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.5
> Reporter: Jim Pivarski
> Labels: exceptions
>
> Symptom: Attempts to match reader = FIXED against writer != FIXED results in
> a RuntimeException ("Unexpected schema type: FIXED"), rather than an
> appropriate Symbol.ErrorAction.
> Reason: In the ResolvingGrammarGenerator.generate method, there are two
> switch statements, one for writerType == readerType and the other for
> writerType != readerType. In the latter, "case FIXED:" is missing.
> This is true in the GitHub version (HEAD?) as well:
> https://github.com/apache/avro/blob/branch-1.3/lang/java/src/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java#L155
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)