Skip to content

Commit

Permalink
Exclude spotbugs to avoid reinitiating field values
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuvindu committed May 13, 2024
1 parent 6197f36 commit 6205b51
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
14 changes: 14 additions & 0 deletions build-config/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,21 @@
<Method name = "visit" />
<Bug pattern="BC_UNCONFIRMED_CAST" />
</Match>
<Match>
<Class name="io.ballerina.lib.avro.deserialize.visitor.DeserializeVisitor" />
<Method name = "extractMapType" />
<Bug pattern="BC_UNCONFIRMED_CAST" />
</Match>
<Match>
<Class name="io.ballerina.lib.avro.deserialize.Deserializer" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="io.ballerina.lib.avro.serialize.Serializer" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="io.ballerina.lib.avro.serialize.Serializer" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public Deserializer() {
}

public Deserializer(Type type, Schema schema) {
this.schema = schema == null ? null : new Schema.Parser().parse(schema.toString());
this.schema = schema == null ? null : schema;
this.type = type == null ? null : TypeUtils.getReferredType(type);
}

public Schema getSchema() {
return new Schema.Parser().parse(schema.toString());
return this.schema;
}

public Type getType() {
return TypeUtils.getReferredType(type);
return this.type;
}

public abstract Object accept(DeserializeVisitor visitor, Object data) throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public abstract class Serializer {

private final String schema;
private final Schema schema;
private final Type type;

public Serializer() {
Expand All @@ -35,20 +35,20 @@ public Serializer() {

public Serializer(Schema schema) {
this.type = null;
this.schema = schema.toString();
this.schema = schema;
}

public Serializer(Schema schema, Type type) {
this.type = TypeUtils.getImpliedType(type);
this.schema = schema.toString();
this.schema = schema;
}

public Schema getSchema() {
return new Schema.Parser().parse(schema);
return this.schema;
}

public Type getType() {
return TypeUtils.getImpliedType(type);
return this.type;
}

public abstract Object convert(SerializeVisitor serializeVisitor, Object data) throws Exception;
Expand Down

0 comments on commit 6205b51

Please sign in to comment.