@@ -443,29 +443,20 @@ private void deleteTableMetadata(String namespace, String table) throws Executio
443443
444444 private Map <String , ObjectStorageNamespaceMetadata > getNamespaceMetadataTable ()
445445 throws ExecutionException {
446- try {
447- Optional <ObjectStorageWrapperResponse > response =
448- wrapper .get (ObjectStorageUtils .getObjectKey (metadataNamespace , NAMESPACE_METADATA_TABLE ));
449- if (!response .isPresent ()) {
450- return Collections .emptyMap ();
451- }
452- return Serializer .deserialize (
453- response .get ().getPayload (),
454- new TypeReference <Map <String , ObjectStorageNamespaceMetadata >>() {});
455- } catch (ObjectStorageWrapperException e ) {
456- throw new ExecutionException ("Failed to get the metadata table." , e );
457- }
446+ return getNamespaceMetadataTable (null );
458447 }
459448
460449 private Map <String , ObjectStorageNamespaceMetadata > getNamespaceMetadataTable (
461- Map <String , String > readVersionMap ) throws ExecutionException {
450+ @ Nullable Map <String , String > readVersionMap ) throws ExecutionException {
462451 try {
463452 Optional <ObjectStorageWrapperResponse > response =
464453 wrapper .get (ObjectStorageUtils .getObjectKey (metadataNamespace , NAMESPACE_METADATA_TABLE ));
465454 if (!response .isPresent ()) {
466455 return Collections .emptyMap ();
467456 }
468- readVersionMap .put (NAMESPACE_METADATA_TABLE , response .get ().getVersion ());
457+ if (readVersionMap != null ) {
458+ readVersionMap .put (NAMESPACE_METADATA_TABLE , response .get ().getVersion ());
459+ }
469460 return Serializer .deserialize (
470461 response .get ().getPayload (),
471462 new TypeReference <Map <String , ObjectStorageNamespaceMetadata >>() {});
@@ -476,29 +467,20 @@ private Map<String, ObjectStorageNamespaceMetadata> getNamespaceMetadataTable(
476467
477468 private Map <String , ObjectStorageTableMetadata > getTableMetadataTable ()
478469 throws ExecutionException {
479- try {
480- Optional <ObjectStorageWrapperResponse > response =
481- wrapper .get (ObjectStorageUtils .getObjectKey (metadataNamespace , TABLE_METADATA_TABLE ));
482- if (!response .isPresent ()) {
483- return Collections .emptyMap ();
484- }
485- return Serializer .deserialize (
486- response .get ().getPayload (),
487- new TypeReference <Map <String , ObjectStorageTableMetadata >>() {});
488- } catch (ObjectStorageWrapperException e ) {
489- throw new ExecutionException ("Failed to get the metadata table." , e );
490- }
470+ return getTableMetadataTable (null );
491471 }
492472
493473 private Map <String , ObjectStorageTableMetadata > getTableMetadataTable (
494- Map <String , String > readVersionMap ) throws ExecutionException {
474+ @ Nullable Map <String , String > readVersionMap ) throws ExecutionException {
495475 try {
496476 Optional <ObjectStorageWrapperResponse > response =
497477 wrapper .get (ObjectStorageUtils .getObjectKey (metadataNamespace , TABLE_METADATA_TABLE ));
498478 if (!response .isPresent ()) {
499479 return Collections .emptyMap ();
500480 }
501- readVersionMap .put (TABLE_METADATA_TABLE , response .get ().getVersion ());
481+ if (readVersionMap != null ) {
482+ readVersionMap .put (TABLE_METADATA_TABLE , response .get ().getVersion ());
483+ }
502484 return Serializer .deserialize (
503485 response .get ().getPayload (),
504486 new TypeReference <Map <String , ObjectStorageTableMetadata >>() {});
0 commit comments