Skip to content

Commit 89f83f3

Browse files
authored
Change BaseWriteChannel.position type to long to fix overflow (#1390)
1 parent 6383cc1 commit 89f83f3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public abstract class BaseWriteChannel<
4141
private final ServiceOptionsT options;
4242
private final EntityT entity;
4343
private final String uploadId;
44-
private int position;
44+
private long position;
4545
private byte[] buffer = new byte[0];
4646
private int limit;
4747
private boolean isOpen = true;
@@ -101,11 +101,11 @@ protected String getUploadId() {
101101
}
102102

103103
@Deprecated
104-
protected int position() {
104+
protected long position() {
105105
return getPosition();
106106
}
107107

108-
protected int getPosition() {
108+
protected long getPosition() {
109109
return position;
110110
}
111111

@@ -119,7 +119,7 @@ protected byte[] getBuffer() {
119119
}
120120

121121
@Deprecated
122-
protected int limit() {
122+
protected long limit() {
123123
return getLimit();
124124
}
125125

@@ -245,7 +245,7 @@ protected abstract static class BaseState<
245245
protected final ServiceOptionsT serviceOptions;
246246
protected final EntityT entity;
247247
protected final String uploadId;
248-
protected final int position;
248+
protected final long position;
249249
protected final byte[] buffer;
250250
protected final boolean isOpen;
251251
protected final int chunkSize;
@@ -274,7 +274,7 @@ public abstract static class Builder<
274274
private final ServiceOptionsT serviceOptions;
275275
private final EntityT entity;
276276
private final String uploadId;
277-
private int position;
277+
private long position;
278278
private byte[] buffer;
279279
private boolean isOpen;
280280
private int chunkSize;
@@ -290,7 +290,7 @@ public Builder<ServiceOptionsT, EntityT> position(int position) {
290290
return setPosition(position);
291291
}
292292

293-
public Builder<ServiceOptionsT, EntityT> setPosition(int position) {
293+
public Builder<ServiceOptionsT, EntityT> setPosition(long position) {
294294
this.position = position;
295295
return this;
296296
}

0 commit comments

Comments
 (0)