Skip to content
4 changes: 3 additions & 1 deletion android/src/main/java/io/grpc/android/UdsChannelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.grpc.ExperimentalApi;
import io.grpc.InsecureChannelCredentials;
import io.grpc.ManagedChannelBuilder;
import io.grpc.internal.GrpcUtil;
import java.lang.reflect.InvocationTargetException;
import javax.annotation.Nullable;
import javax.net.SocketFactory;
Expand Down Expand Up @@ -63,6 +64,7 @@ private static Class<? extends ManagedChannelBuilder> findOkHttp() {
* @param path unix file system path to use for Unix Domain Socket.
* @param namespace the type of the namespace that the path belongs to.
*/
@SuppressWarnings("ConstantConditions")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ejona86 , This code was added to fix the NullPointerException warning that was appearing for proxyDetector.

Warning:(85, 22) Method invocation 'proxyDetector' may produce 'NullPointerException'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IDE was saying that, or our build? We don't have any nullness checks in our build. We don't tend to put IDE suppressions in the code.

public static ManagedChannelBuilder<?> forPath(String path, Namespace namespace) {
if (OKHTTP_CHANNEL_BUILDER_CLASS == null) {
throw new UnsupportedOperationException("OkHttpChannelBuilder not found on the classpath");
Expand All @@ -81,7 +83,7 @@ public static ManagedChannelBuilder<?> forPath(String path, Namespace namespace)
OKHTTP_CHANNEL_BUILDER_CLASS
.getMethod("socketFactory", SocketFactory.class)
.invoke(builder, new UdsSocketFactory(path, namespace));
return builder;
return builder.proxyDetector(GrpcUtil.NOOP_PROXY_DETECTOR);
} catch (IllegalAccessException e) {
throw new RuntimeException("Failed to create OkHttpChannelBuilder", e);
} catch (NoSuchMethodException e) {
Expand Down