@Override public InputStream getContent() throws IOException { final RepositoryItemUidLock lock = wrappedUid.getLock(); lock.lock( Action.read ); try { return new ReadLockingInputStream( lock, getTarget().getContent() ); } catch ( IOException e ) { lock.unlock(); throw e; } catch ( Exception e ) { lock.unlock(); // wrap it IOException w = new IOException( e.getMessage() ); w.initCause( e ); throw w; } }
file.setContentLocator( new ReadLockingContentLocator( uid, file.getContentLocator() ) );