Skip to content

Commit 7f332c6

Browse files
ahanikelAxel Hanikel
andauthored
OAK-11480 - Graceful handling when getErrorCode() returns null. (#2078)
Co-authored-by: Axel Hanikel <ahanikel@adobe.com>
1 parent 91321a0 commit 7f332c6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureRepositoryLock.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ private void refreshLease() {
153153

154154
if (e instanceof BlobStorageException) {
155155
BlobStorageException storageException = (BlobStorageException) e;
156-
if (Set.of(BlobErrorCode.OPERATION_TIMED_OUT,
156+
BlobErrorCode errorCode = storageException.getErrorCode();
157+
if (errorCode != null &&
158+
Set.of(BlobErrorCode.OPERATION_TIMED_OUT,
157159
BlobErrorCode.SERVER_BUSY,
158-
BlobErrorCode.INTERNAL_ERROR).contains(storageException.getErrorCode())) {
160+
BlobErrorCode.INTERNAL_ERROR).contains(errorCode)) {
159161
log.warn("Could not renew the lease due to the operation timeout or service unavailability. Retry in progress ...", e);
160162
} else {
161163
log.warn("Could not renew lease due to storage exception. Retry in progress ... ", e);

oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/v8/AzureRepositoryLockV8.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ private void refreshLease() {
155155

156156
if (e instanceof StorageException) {
157157
StorageException storageException = (StorageException) e;
158-
if (Set.of(StorageErrorCodeStrings.OPERATION_TIMED_OUT
158+
String errorCode = storageException.getErrorCode();
159+
if (errorCode != null &&
160+
Set.of(StorageErrorCodeStrings.OPERATION_TIMED_OUT
159161
, StorageErrorCode.SERVICE_INTERNAL_ERROR
160162
, StorageErrorCodeStrings.SERVER_BUSY
161-
, StorageErrorCodeStrings.INTERNAL_ERROR).contains(storageException.getErrorCode())) {
163+
, StorageErrorCodeStrings.INTERNAL_ERROR).contains(errorCode)) {
162164
log.warn("Could not renew the lease due to the operation timeout or service unavailability. Retry in progress ...", e);
163165
} else if (storageException.getHttpStatusCode() == Constants.HeaderConstants.HTTP_UNUSED_306) {
164166
log.warn("Client side error. Retry in progress ...", e);

0 commit comments

Comments
 (0)