Skip to content

Commit

Permalink
Remove ExtensionRegistry from Java SDK (OakClientSession and OakServe…
Browse files Browse the repository at this point in the history
…rSession).

It is not supported in Android (not present in lite proto) and it is not
needed (messages parsed don't have extensions).

Change-Id: Ic26432ffe440a7de89ce735e56448bb75042a145
ernoc committed Jan 28, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 1d022f2 commit 9070c20
Showing 3 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion java/src/main/java/com/google/oak/session/BUILD
Original file line number Diff line number Diff line change
@@ -59,7 +59,6 @@ android_library(
"//java/src/main/java/com/google/oak/session/jni:oak_client_session_jni",
"//proto/session:session_java_proto",
"@com_google_protobuf//:protobuf_javalite",
"@com_google_protobuf//java/core",
],
)

Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@
import com.google.oak.session.v1.PlaintextMessage;
import com.google.oak.session.v1.SessionRequest;
import com.google.oak.session.v1.SessionResponse;
import com.google.protobuf.ExtensionRegistry;
import com.google.protobuf.InvalidProtocolBufferException;
import java.util.Optional;

@@ -47,8 +46,7 @@ public Optional<SessionRequest> getOutgoingMessage() {
return Optional.empty();
}
try {
return Optional.of(
SessionRequest.parseFrom(serializedMessage, ExtensionRegistry.getEmptyRegistry()));
return Optional.of(SessionRequest.parseFrom(serializedMessage));
} catch (InvalidProtocolBufferException e) {
throw new OakSessionException("Couldn't parse the proto from the native session", e);
}
@@ -64,8 +62,7 @@ public Optional<PlaintextMessage> read() {
return Optional.empty();
}
try {
return Optional.of(
PlaintextMessage.parseFrom(serializedMessage, ExtensionRegistry.getEmptyRegistry()));
return Optional.of(PlaintextMessage.parseFrom(serializedMessage));
} catch (InvalidProtocolBufferException e) {
throw new OakSessionException("Couldn't parse the proto from the native session", e);
}
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@
import com.google.oak.session.v1.PlaintextMessage;
import com.google.oak.session.v1.SessionRequest;
import com.google.oak.session.v1.SessionResponse;
import com.google.protobuf.ExtensionRegistry;
import com.google.protobuf.InvalidProtocolBufferException;
import java.util.Optional;

@@ -47,8 +46,7 @@ public Optional<SessionResponse> getOutgoingMessage() {
return Optional.empty();
}
try {
return Optional.of(
SessionResponse.parseFrom(serializedMessage, ExtensionRegistry.getEmptyRegistry()));
return Optional.of(SessionResponse.parseFrom(serializedMessage));
} catch (InvalidProtocolBufferException e) {
throw new OakSessionException("Couldn't parse the proto from the native session", e);
}
@@ -64,8 +62,7 @@ public Optional<PlaintextMessage> read() {
return Optional.empty();
}
try {
return Optional.of(
PlaintextMessage.parseFrom(serializedMessage, ExtensionRegistry.getEmptyRegistry()));
return Optional.of(PlaintextMessage.parseFrom(serializedMessage));
} catch (InvalidProtocolBufferException e) {
throw new OakSessionException("Couldn't parse the proto from the native session", e);
}

0 comments on commit 9070c20

Please sign in to comment.