- @SuppressWarnings("unchecked")
- private static boolean fileShouldBeExtracted(ZipFile zipFile, ZipArchiveEntry entry) throws IOException {
- logger.debug(ApplicationMsgs.DISTRIBUTION_EVENT, "Checking if " + entry.getName() + " should be extracted...");
-
- boolean extractFile = false;
- if (YAMLFILE_EXTENSION_REGEX.matcher(entry.getName()).matches()) {
- try {
- Yaml yamlParser = new Yaml();
- HashMap<String, Object> yaml =
- (LinkedHashMap<String, Object>) yamlParser.load(zipFile.getInputStream(entry));
- HashMap<String, Object> metadata = (LinkedHashMap<String, Object>) yaml.get("metadata");
-
- extractFile = metadata != null && metadata.containsKey(TYPE)
- && !INVALID_TYPES.contains(metadata.get(TYPE).toString().toUpperCase())
- && !metadata.get(TYPE).toString().isEmpty();
- } catch (Exception e) {
- logger.error(ApplicationMsgs.DISTRIBUTION_EVENT,
- "Unable to verify " + entry.getName() + " contains a valid resource type: " + e.getMessage());
- }
- }
-
- logger.debug(ApplicationMsgs.DISTRIBUTION_EVENT, "Keeping file: " + entry.getName() + "? : " + extractFile);
-
+ /**
+ * @param entry
+ * @return
+ */
+ private static boolean fileShouldBeExtracted(ZipArchiveEntry entry) {
+ boolean extractFile = YAMLFILE_EXTENSION_REGEX.matcher(entry.getName()).matches();
+ logger.debug(ApplicationMsgs.DISTRIBUTION_EVENT,
+ "Checking if " + entry.getName() + " should be extracted... " + extractFile);