File tree Expand file tree Collapse file tree 1 file changed +6
-22
lines changed Expand file tree Collapse file tree 1 file changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -76,28 +76,12 @@ pub fn extract_write_params(
7676 extract_storage_options ( env, storage_options_obj) ?;
7777
7878 // Extract storage options provider if present
79- let storage_options_provider = if !storage_options_provider_obj. is_null ( ) {
80- // Check if it's an Optional.empty()
81- let is_present = env
82- . call_method ( storage_options_provider_obj, "isPresent" , "()Z" , & [ ] ) ?
83- . z ( ) ?;
84- if is_present {
85- // Get the value from Optional
86- let provider_obj = env
87- . call_method (
88- storage_options_provider_obj,
89- "get" ,
90- "()Ljava/lang/Object;" ,
91- & [ ] ,
92- ) ?
93- . l ( ) ?;
94- Some ( JavaStorageOptionsProvider :: new ( env, provider_obj) ?)
95- } else {
96- None
97- }
98- } else {
99- None
100- } ;
79+ let storage_options_provider = env. get_optional ( storage_options_provider_obj, |env, obj| {
80+ let provider_obj = env
81+ . call_method ( obj, "get" , "()Ljava/lang/Object;" , & [ ] ) ?
82+ . l ( ) ?;
83+ JavaStorageOptionsProvider :: new ( env, provider_obj)
84+ } ) ?;
10185
10286 let storage_options_provider_arc: Option < Arc < dyn StorageOptionsProvider > > =
10387 storage_options_provider. map ( |v| Arc :: new ( v) as Arc < dyn StorageOptionsProvider > ) ;
You can’t perform that action at this time.
0 commit comments