@@ -179,7 +179,12 @@ public int perform(Context ctx, String id) throws IOException {
179179 private void recover (Context ctx , ReplicaManager repMan , String id ) throws IOException {
180180 final String objId = repMan .storageId (ctx , id , archFmt );
181181 final File archive = repMan .fetchObject (ctx , storeGroupName , objId );
182- final DSpaceObject dso = dereference (ctx , id );
182+ DSpaceObject dso ;
183+ try {
184+ dso = dspaceObjectUtils .findDSpaceObject (ctx ,id );
185+ } catch (SQLException sqlE ) {
186+ throw new IOException (sqlE .getMessage (), sqlE );
187+ }
183188 if (archive != null && dso == null ) {
184189 final BagItAipReader reader = new BagItAipReader (archive .toPath ());
185190 final Properties props = reader .readProperties ();
@@ -197,7 +202,7 @@ private void recover(Context ctx, ReplicaManager repMan, String id) throws IOExc
197202 // discard bag when done
198203 reader .clean ();
199204 } else if (dso != null ) {
200- log .warn ("Unable to restore object for " + id + " . Object already exists!" );
205+ log .warn ("Unable to restore object for {} . Object already exists!" , id );
201206 }
202207 }
203208
@@ -232,10 +237,8 @@ private void recoverItem(Context ctx, File archive, String objId, Properties pro
232237 itemService .withdraw (ctx , item );
233238 }
234239 embargoService .setEmbargo (ctx , item );
235- } catch (AuthorizeException authE ) {
240+ } catch (AuthorizeException | SQLException authE ) {
236241 throw new IOException (authE );
237- } catch (SQLException sqlE ) {
238- throw new IOException (sqlE );
239242 }
240243 }
241244
@@ -259,10 +262,8 @@ private void recoverCollection(Context ctx, File archive, String collId, String
259262 // update with AIP data
260263 Packer packer = PackerFactory .instance (ctx , coll );
261264 packer .unpack (archive );
262- } catch (AuthorizeException authE ) {
265+ } catch (AuthorizeException | SQLException authE ) {
263266 throw new IOException (authE );
264- } catch (SQLException sqlE ) {
265- throw new IOException (sqlE );
266267 }
267268 }
268269
@@ -287,10 +288,8 @@ private void recoverCommunity(Context ctx, File archive, String commId, String p
287288 // update with AIP data
288289 Packer packer = PackerFactory .instance (ctx , comm );
289290 packer .unpack (archive );
290- } catch (AuthorizeException authE ) {
291+ } catch (AuthorizeException | SQLException authE ) {
291292 throw new IOException (authE );
292- } catch (SQLException sqlE ) {
293- throw new IOException (sqlE );
294293 }
295294 }
296295
0 commit comments