private void validateResourceZip(App app) { FileMeta appZipMeta = app.getSourceFiles(); if (appZipMeta != null) { File fileStoreFile = fileStore.getFile(appZipMeta.getId()); if (fileStoreFile == null) { LOG.error("Resource zip '{}' for app '{}' missing in file store", appZipMeta.getId(), app.getName()); throw new RuntimeException("An error occurred trying to create or update app"); } ZipFile zipFile; try { zipFile = new ZipFile(fileStoreFile); } catch (ZipException e) { LOG.error("Error creating zip file object", e); throw new RuntimeException("An error occurred trying to create or update app"); } if (!zipFile.isValidZipFile()) { throw new MolgenisValidationException(new ConstraintViolation( String.format("'%s' is not a valid zip file.", appZipMeta.getFilename()))); } } } }
if (appSourceArchive != null) File fileStoreFile = fileStore.getFile(appSourceArchive.getId()); if (fileStoreFile == null) LOG.error("Source archive '{}' for app '{}' missing in file store", appSourceArchive.getId(), app.getName()); throw new RuntimeException("An error occurred trying to activate app");
@Override @RunAsSystem public FileSystemResource getThemeData(String styleName, BootstrapVersion bootstrapVersion) throws MolgenisStyleException { StyleSheet styleSheet = findThemeByName(styleName); if (styleSheet == null) { throw new MolgenisStyleException("No theme found for with name: " + styleName); } // Fetch the theme file from the store. FileMeta fileMeta; if (bootstrapVersion.equals(BOOTSTRAP_VERSION_3)) { fileMeta = styleSheet.getBootstrap3Theme(); } else { fileMeta = styleSheet.getBootstrap4Theme(); // If no bootstrap 4 theme was set fetch the default theme from the resources folder if (fileMeta == null) { StyleSheet fallBackTheme = findThemeByName(BOOTSTRAP_FALL_BACK_THEME); fileMeta = fallBackTheme.getBootstrap4Theme(); } } File file = fileStore.getFile(fileMeta.getId()); return new FileSystemResource(file); }