472 try {
473 AccessController.doPrivileged((PrivilegedExceptionAction<Void>)() -> {
474 sync(); return null;
475 });
476 ch.close(); // close the ch just in case no update
477 // and sync didn't close the ch
478 } catch (PrivilegedActionException e) {
479 throw (IOException)e.getException();
480 } finally {
481 endWrite();
482 }
483
484 synchronized (inflaters) {
485 for (Inflater inf : inflaters)
486 inf.end();
487 }
488 synchronized (deflaters) {
489 for (Deflater def : deflaters)
490 def.end();
491 }
492
493 IOException ioe = null;
494 synchronized (tmppaths) {
495 for (Path p : tmppaths) {
496 try {
497 AccessController.doPrivileged(
498 (PrivilegedExceptionAction<Boolean>)() -> Files.deleteIfExists(p));
499 } catch (PrivilegedActionException e) {
500 IOException x = (IOException)e.getException();
501 if (ioe == null)
502 ioe = x;
503 else
504 ioe.addSuppressed(x);
505 }
506 }
507 }
508 provider.removeFileSystem(zfpath, this);
509 if (ioe != null)
510 throw ioe;
511 }
|
472 try {
473 AccessController.doPrivileged((PrivilegedExceptionAction<Void>)() -> {
474 sync(); return null;
475 });
476 ch.close(); // close the ch just in case no update
477 // and sync didn't close the ch
478 } catch (PrivilegedActionException e) {
479 throw (IOException)e.getException();
480 } finally {
481 endWrite();
482 }
483
484 synchronized (inflaters) {
485 for (Inflater inf : inflaters)
486 inf.end();
487 }
488 synchronized (deflaters) {
489 for (Deflater def : deflaters)
490 def.end();
491 }
492 beginWrite(); // lock and sync
493 try {
494 // dereference the inodes map, since each entry in that map
495 // can potentially hold on to large amounts of data (especially
496 // IndexNode of type ZipFileSystem$Entry)
497 inodes = null;
498 } finally {
499 endWrite();
500 }
501
502 IOException ioe = null;
503 synchronized (tmppaths) {
504 for (Path p : tmppaths) {
505 try {
506 AccessController.doPrivileged(
507 (PrivilegedExceptionAction<Boolean>)() -> Files.deleteIfExists(p));
508 } catch (PrivilegedActionException e) {
509 IOException x = (IOException)e.getException();
510 if (ioe == null)
511 ioe = x;
512 else
513 ioe.addSuppressed(x);
514 }
515 }
516 }
517 provider.removeFileSystem(zfpath, this);
518 if (ioe != null)
519 throw ioe;
520 }
|