modules/jdk.packager/src/main/java/com/oracle/tools/packager/linux/LinuxDebBundler.java

Print this page




 359 
 360             imageDir.mkdirs();
 361             configDir.mkdirs();
 362             if (prepareProto(p) && prepareProjectConfig(p)) {
 363                 return buildDeb(p, outdir);
 364             }
 365             return null;
 366         } catch (IOException ex) {
 367             ex.printStackTrace();
 368             return null;
 369         } finally {
 370             try {
 371                 if (VERBOSE.fetchFrom(p)) {
 372                     saveConfigFiles(p);
 373                 }
 374                 if (imageDir != null && !Log.isDebug()) {
 375                     IOUtils.deleteRecursive(imageDir);
 376                 } else if (imageDir != null) {
 377                     Log.info(MessageFormat.format(I18N.getString("message.debug-working-directory"), imageDir.getAbsolutePath()));
 378                 }
 379             } catch (FileNotFoundException ex) {
 380                 //noinspection ReturnInsideFinallyBlock

 381                 return null;
 382             }
 383         }
 384     }
 385 
 386     /*
 387      * set permissions with a string like "rwxr-xr-x"
 388      *
 389      * This cannot be directly backport to 22u which is unfortunately built with 1.6
 390      */
 391     private void setPermissions(File file, String permissions) {
 392         Set<PosixFilePermission> filePermissions = PosixFilePermissions.fromString(permissions);
 393         try {
 394             if (file.exists()) {
 395                 Files.setPosixFilePermissions(file.toPath(), filePermissions);
 396             }
 397         } catch (IOException ex) {
 398             Logger.getLogger(LinuxDebBundler.class.getName()).log(Level.SEVERE, null, ex);
 399         }
 400 




 359 
 360             imageDir.mkdirs();
 361             configDir.mkdirs();
 362             if (prepareProto(p) && prepareProjectConfig(p)) {
 363                 return buildDeb(p, outdir);
 364             }
 365             return null;
 366         } catch (IOException ex) {
 367             ex.printStackTrace();
 368             return null;
 369         } finally {
 370             try {
 371                 if (VERBOSE.fetchFrom(p)) {
 372                     saveConfigFiles(p);
 373                 }
 374                 if (imageDir != null && !Log.isDebug()) {
 375                     IOUtils.deleteRecursive(imageDir);
 376                 } else if (imageDir != null) {
 377                     Log.info(MessageFormat.format(I18N.getString("message.debug-working-directory"), imageDir.getAbsolutePath()));
 378                 }
 379             } catch (IOException ex) {
 380                 //noinspection ReturnInsideFinallyBlock
 381                 Log.debug(ex.getMessage());
 382                 return null;
 383             }
 384         }
 385     }
 386 
 387     /*
 388      * set permissions with a string like "rwxr-xr-x"
 389      *
 390      * This cannot be directly backport to 22u which is unfortunately built with 1.6
 391      */
 392     private void setPermissions(File file, String permissions) {
 393         Set<PosixFilePermission> filePermissions = PosixFilePermissions.fromString(permissions);
 394         try {
 395             if (file.exists()) {
 396                 Files.setPosixFilePermissions(file.toPath(), filePermissions);
 397             }
 398         } catch (IOException ex) {
 399             Logger.getLogger(LinuxDebBundler.class.getName()).log(Level.SEVERE, null, ex);
 400         }
 401