Skip to content

Commit cf9adf3

Browse files
authored
Merge pull request #7 from GoodforGod/hotfix/1.1.6
1.1.6
2 parents 38a4b26 + ae02ee4 commit cf9adf3

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Avro Decoder with support optional fields in JSON.
1313
**Gradle**
1414
```groovy
1515
dependencies {
16-
implementation 'com.github.goodforgod:avro-json-optional-decoder:1.1.5'
16+
implementation 'com.github.goodforgod:avro-json-optional-decoder:1.1.6'
1717
}
1818
```
1919

@@ -22,7 +22,7 @@ dependencies {
2222
<dependency>
2323
<groupId>com.github.goodforgod</groupId>
2424
<artifactId>avro-json-optional-decoder</artifactId>
25-
<version>1.1.5</version>
25+
<version>1.1.6</version>
2626
</dependency>
2727
```
2828

@@ -34,7 +34,7 @@ Library is compatible with different Apache Avro versions. Please use compatible
3434

3535
| [Apache Avro](https://mvnrepository.com/artifact/org.apache.avro/avro-compiler) Version | [Library](https://mvnrepository.com/artifact/com.github.goodforgod/avro-json-optional-decoder) Version |
3636
| ---- | ---- |
37-
| [1.9.2](https://mvnrepository.com/artifact/org.apache.avro/avro-compiler/1.9.2) | [1.1.5](https://mvnrepository.com/artifact/com.github.goodforgod/avro-json-optional-decoder/1.1.4) |
37+
| [1.9.2](https://mvnrepository.com/artifact/org.apache.avro/avro-compiler/1.9.2) | [1.1.6](https://mvnrepository.com/artifact/com.github.goodforgod/avro-json-optional-decoder/1.1.4) |
3838
| [1.8.2](https://mvnrepository.com/artifact/org.apache.avro/avro-compiler/1.8.2) | [1.0.1](https://mvnrepository.com/artifact/com.github.goodforgod/avro-json-optional-decoder/1.0.1) |
3939

4040

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
groupId=com.github.goodforgod
22
artifactId=avro-json-optional-decoder
3-
artifactVersion=1.1.5
3+
artifactVersion=1.1.6
44

55

66
##### GRADLE

src/main/java/io/avro/decoder/JsonOptionalDecoder.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@ private void injectDefaultValueIfAvailable(final JsonParser in, String fieldName
557557
}
558558

559559
private static Field findField(Schema schema, String name) {
560+
if (!schema.getType().equals(Schema.Type.RECORD)) {
561+
return null;
562+
}
563+
560564
if (schema.getField(name) != null) {
561565
return schema.getField(name);
562566
}
@@ -570,8 +574,7 @@ private static Field findField(Schema schema, String name) {
570574
.map(sub -> {
571575
if (sub.getType().equals(Schema.Type.RECORD)) {
572576
return findField(sub, name);
573-
} else if (sub.getType().equals(Schema.Type.ARRAY)
574-
&& sub.getElementType().getType().equals(Schema.Type.RECORD)) {
577+
} else if (sub.getType().equals(Schema.Type.ARRAY)) {
575578
return findField(sub.getElementType(), name);
576579
} else {
577580
return null;

0 commit comments

Comments
 (0)