@@ -359,21 +359,24 @@ public CompletableFuture<NotifyLakeTableOffsetResponse> notifyLakeTableOffset(
359359 }
360360
361361 private void authorizeTable (OperationType operationType , long tableId ) {
362- TablePath tablePath = metadataCache .getTablePath (tableId ).orElse (null );
363- if (tablePath == null ) {
364- throw new UnknownTableOrBucketException (
365- String .format (
366- "This server %s does not know this table ID %s. This may happen when the table "
367- + "metadata cache in the server is not updated yet." ,
368- serviceName , tableId ));
369- }
370- if (authorizer != null
371- && !authorizer .isAuthorized (
372- currentSession (), operationType , Resource .table (tablePath ))) {
373- throw new AuthorizationException (
374- String .format (
375- "No permission to %s table %s in database %s" ,
376- operationType , tablePath .getTableName (), tablePath .getDatabaseName ()));
362+ if (authorizer != null ) {
363+ TablePath tablePath = metadataCache .getTablePath (tableId ).orElse (null );
364+ if (tablePath == null ) {
365+ throw new UnknownTableOrBucketException (
366+ String .format (
367+ "This server %s does not know this table ID %s. This may happen when the table "
368+ + "metadata cache in the server is not updated yet." ,
369+ serviceName , tableId ));
370+ }
371+ if (!authorizer .isAuthorized (
372+ currentSession (), operationType , Resource .table (tablePath ))) {
373+ throw new AuthorizationException (
374+ String .format (
375+ "No permission to %s table %s in database %s" ,
376+ operationType ,
377+ tablePath .getTableName (),
378+ tablePath .getDatabaseName ()));
379+ }
377380 }
378381 }
379382
0 commit comments