Skip to content

Commit

Permalink
Fixing checker framework errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
chamikaramj committed Sep 29, 2022
1 parent 6ec0d64 commit 89fe0ea
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.beam.sdk.values.Row;
import org.apache.beam.sdk.values.TupleTag;
import org.apache.beam.vendor.grpc.v1p48p1.com.google.protobuf.InvalidProtocolBufferException;
import org.checkerframework.checker.nullness.qual.Nullable;

@SuppressWarnings({"rawtypes"})
public class ExpansionServiceSchemaTransformProvider implements TransformProvider {
Expand All @@ -49,9 +50,9 @@ public class ExpansionServiceSchemaTransformProvider implements TransformProvide

private Map<String, org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider>
schemaTransformProviders = new HashMap<>();
private static ExpansionServiceSchemaTransformProvider transformProvider = null;
private static @Nullable ExpansionServiceSchemaTransformProvider transformProvider = null;

private void loadSchemaTransforms() {
private ExpansionServiceSchemaTransformProvider() {
try {
for (org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider schemaTransformProvider :
ServiceLoader.load(
Expand All @@ -68,10 +69,6 @@ private void loadSchemaTransforms() {
}
}

private ExpansionServiceSchemaTransformProvider() {
loadSchemaTransforms();
}

public static ExpansionServiceSchemaTransformProvider of() {
if (transformProvider == null) {
transformProvider = new ExpansionServiceSchemaTransformProvider();
Expand Down Expand Up @@ -142,6 +139,10 @@ public PTransform getTransform(FunctionSpec spec) {
String identifier = payload.getIdentifier();
org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider provider =
schemaTransformProviders.get(identifier);
if (provider == null) {
throw new IllegalArgumentException(
"Could not find a SchemaTransform with identifier " + identifier);
}

Schema configSchemaFromRequest =
SchemaTranslation.schemaFromProto((payload.getConfigurationSchema()));
Expand Down

0 comments on commit 89fe0ea

Please sign in to comment.