googleapis / googleapis/google-cloud-java

[java-storage-nio] FakeStorageRpc/LocalStorageHelper: leads to logs about needing to call Builder#setApplicationName

Đang mở
#12,552 0 bình luận 0 reaction 1 người được giao Được @JesseLovelace nhận Xem trên GitHub
api: storage priority: p3
Ngôn ngữ chính
Java
Star
2.1k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
154

Mô tả

#### Steps to reproduce

1. Use LocalStorageHelper at all
2. See log messages needing to call `setApplicationName`

#### Code example

Anything using LocalStorageHelper, eg

```
LocalStorageHelper.customOptions(true).getService().writer(...)
```

ends up running this code in FakeStorageRpc.java

```
public com.google.api.services.storage.Storage getStorage() {
HttpTransport transport = new FakeStorageRpcHttpTransport();
HttpRequestInitializer httpRequestInitializer = request -> {};
return new com.google.api.services.storage.Storage(
transport, new GsonFactory(), httpRequestInitializer);
}
```

This `Storage` constructor creates and then immediately uses a `Storage.Builder`, which means there's no place to call `Builder#setApplicationName`, leading to an unavoidable log.

#### Stack trace

The logged message is:

```
WARN com.google.api.client.googleapis.services.AbstractGoogleClient - Application name is not set. Call Builder#setApplicationName.
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.