Skip to content

Commit 40e0f0b

Browse files
Fix handling when there is no NextRowKey in response header (Azure#34143)
* Allow nextRowKey to be null when list next page * Update CHANGELOG.md * Update EntityPaged.java The build was failing for checkstyle violations. This adjustment should fix them. --------- Co-authored-by: Jair Myree <[email protected]>
1 parent 481753e commit 40e0f0b

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

sdk/tables/azure-data-tables/CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
### Breaking Changes
88

99
### Bugs Fixed
10-
1110
- Fixed bug that disallowed empty strings as partition and row keys
11+
- Fixed handling of paging headers when Table Storage returned a `x-ms-continuation-NextPartitionKey` but no `x-ms-continuation-NextRowKey`. This was causing the subsequent pages are not fetched.
1212
### Other Changes
1313

1414
## 12.3.9 (2023-03-08)
@@ -89,7 +89,7 @@
8989

9090
#### Dependency Updates
9191
- Upgraded `azure-core` dependency to `1.29.1`
92-
- Upgraded `azure-core-http-netty` dependency to `1.12.2`
92+
- Upgraded `azure-core-http-netty` dependency to `1.12.2`
9393

9494
## 12.3.0 (2022-05-11)
9595

@@ -122,7 +122,7 @@
122122
## 12.2.0 (2022-02-10)
123123

124124
### Features added
125-
- Implemented new traits (micro-interfaces) in `TableClientBuiler` and `TableServiceClientBuilder`. This makes the experience of using client builders more consistent across libraries in the Azure SDK for Java.
125+
- Implemented new traits (micro-interfaces) in `TableClientBuiler` and `TableServiceClientBuilder`. This makes the experience of using client builders more consistent across libraries in the Azure SDK for Java.
126126

127127
### Other Changes
128128

@@ -133,12 +133,12 @@
133133
## 12.1.5 (2022-01-11)
134134

135135
### Bugs fixed
136-
- Fixed issue that made it so single quotes in entity names were not properly escaped according to OData standards. [[25066]](https://github.com/Azure/azure-sdk-for-java/pull/25066)
136+
- Fixed issue that made it so single quotes in entity names were not properly escaped according to OData standards. [[25066]](https://github.com/Azure/azure-sdk-for-java/pull/25066)
137137

138138
#### Dependency Updates
139139
- Upgraded `azure-core` dependency to `1.24.1`
140140
- Upgraded `azure-core-http-netty` dependency to `1.11.6`
141-
141+
142142
## 12.1.4 (2021-11-19)
143143

144144
### Other Changes

sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,13 +950,13 @@ private <T extends TableEntity> Mono<PagedResponse<T>> listEntitiesNextPage(Stri
950950

951951
String[] split = token.split(DELIMITER_CONTINUATION_TOKEN, 2);
952952

953-
if (split.length != 2) {
953+
if (split.length == 0) {
954954
return monoError(logger, new RuntimeException(
955-
"Split done incorrectly, must have partition and row key: " + token));
955+
"Split done incorrectly, must have partition key: " + token));
956956
}
957957

958958
String nextPartitionKey = split[0];
959-
String nextRowKey = split[1];
959+
String nextRowKey = split.length > 1 ? split[1] : null;
960960

961961
return listEntities(nextPartitionKey, nextRowKey, context, options, resultType);
962962
}

sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,13 +959,13 @@ private <T extends TableEntity> PagedResponse<T> listEntitiesNextPage(String tok
959959

960960
String[] split = token.split(DELIMITER_CONTINUATION_TOKEN, 2);
961961

962-
if (split.length != 2) {
962+
if (split.length == 0) {
963963
throw logger.logExceptionAsError(new RuntimeException(
964-
"Split done incorrectly, must have partition and row key: " + token));
964+
"Split done incorrectly, must have partition key: " + token));
965965
}
966966

967967
String nextPartitionKey = split[0];
968-
String nextRowKey = split[1];
968+
String nextRowKey = split.length > 1 ? split[1] : null;
969969

970970
return listEntities(nextPartitionKey, nextRowKey, context, options, resultType);
971971

sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/EntityPaged.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ public class EntityPaged<T extends TableEntity> implements PagedResponse<T> {
2121

2222
public EntityPaged(Response<TableEntityQueryResponse> httpResponse, List<T> entityList,
2323
String nextPartitionKey, String nextRowKey) {
24-
if (nextPartitionKey == null || nextRowKey == null) {
24+
if (nextPartitionKey == null) {
2525
this.continuationToken = null;
26+
} else if (nextRowKey == null) {
27+
this.continuationToken = nextPartitionKey;
2628
} else {
2729
this.continuationToken = String.join(DELIMITER_CONTINUATION_TOKEN, nextPartitionKey, nextRowKey);
2830
}

0 commit comments

Comments
 (0)