@@ -169,35 +169,33 @@ public void close() {
169
169
throw new DataException ("Target already closed" );
170
170
}
171
171
172
- try {
173
- if (!deleted ) {
174
- // If we get error on closing the stream we must return it to the caller
175
- RuntimeException streamCloseException = null ;
176
- try {
177
- closeStreams ();
178
- } catch (final RuntimeException e ) {
179
- streamCloseException = e ;
180
- }
172
+ if (!deleted ) {
173
+ // If we get error on closing the stream we must return it to the caller
174
+ RuntimeException streamCloseException = null ;
175
+ try {
176
+ closeStreams ();
177
+ } catch (final RuntimeException e ) {
178
+ streamCloseException = e ;
179
+ }
181
180
182
- // Only write meta for the root target.
183
- if (parent == null ) {
184
- // Update attributes and write the manifest.
185
- updateAttribute (this , MetaFields .RAW_SIZE , String .valueOf (getStreamSize ()));
186
- updateAttribute (this , MetaFields .FILE_SIZE , String .valueOf (getTotalFileSize ()));
187
- writeManifest ();
188
-
189
- if (streamCloseException == null ) {
190
- // Unlock will update the meta data so set it back on the stream
191
- // target so the client has the up to date copy
192
- unlock (getMeta (), getAttributes ());
193
- } else {
194
- throw streamCloseException ;
195
- }
181
+ // Only write meta for the root target.
182
+ if (parent == null ) {
183
+ // Update attributes and write the manifest.
184
+ updateAttribute (this , MetaFields .RAW_SIZE , String .valueOf (getStreamSize ()));
185
+ updateAttribute (this , MetaFields .FILE_SIZE , String .valueOf (getTotalFileSize ()));
186
+ writeManifest ();
187
+
188
+ if (streamCloseException == null ) {
189
+ // Unlock will update the meta data so set it back on the stream
190
+ // target so the client has the up to date copy
191
+ unlock (getMeta (), getAttributes ());
192
+ } else {
193
+ throw streamCloseException ;
196
194
}
197
195
}
198
- } finally {
199
- closed = true ;
200
196
}
197
+
198
+ closed = true ;
201
199
}
202
200
203
201
private void unlock (final Meta meta , final AttributeMap attributeMap ) {
@@ -224,19 +222,14 @@ public void delete() {
224
222
}
225
223
226
224
try {
227
- try {
228
- // Close the stream target.
229
- closeStreams ();
230
- } finally {
231
- closed = true ;
232
-
233
- // Only delete the root target.
234
- if (parent == null ) {
235
- // Mark the target meta as deleted.
236
- this .meta = metaService .updateStatus (meta , Status .LOCKED , Status .DELETED );
237
- }
238
- }
225
+ // Close the stream target.
226
+ closeStreams ();
239
227
} finally {
228
+ // Only delete the root target.
229
+ if (parent == null ) {
230
+ // Mark the target meta as deleted.
231
+ this .meta = metaService .updateStatus (meta , Status .LOCKED , Status .DELETED );
232
+ }
240
233
deleted = true ;
241
234
}
242
235
}
0 commit comments