test_class.declarator: RESOURCE_DIR = "/test-packages/"
test_class.modifier: private static final
test_class.original_string: private static final String RESOURCE_DIR = "/test-packages/";
test_class.type: String
test_class.var_name: RESOURCE_DIR
test_class.file: vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/impl/DefaultPackageInfoTest.java
test_class.identifier: DefaultPackageInfoTest
test_case.body: @Test
      public void test_non_valid_package() throws Exception {
          PackageInfo info = DefaultPackageInfo.read(load("non-valid-package.zip"));
          assertNull("PackageInfo", info);
      }
test_case.class_method_signature: DefaultPackageInfoTest.test_non_valid_package()
test_case.full_signature: @Test public void test_non_valid_package()
test_case.identifier: test_non_valid_package
test_case.invocations: read load assertNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_non_valid_package()
focal_class.declarator: PROPERTIES_FILE = new File(Constants.META_DIR + "/" + Constants.PROPERTIES_XML)
focal_class.modifier: private static final
focal_class.original_string: private static final File PROPERTIES_FILE = new File(Constants.META_DIR + "/" + Constants.PROPERTIES_XML);
focal_class.type: File
focal_class.var_name: PROPERTIES_FILE
focal_class.declarator: FILTER_FILE = new File(Constants.META_DIR + "/" + Constants.FILTER_XML)
focal_class.modifier: private static final
focal_class.original_string: private static final File FILTER_FILE = new File(Constants.META_DIR + "/" + Constants.FILTER_XML);
focal_class.type: File
focal_class.var_name: FILTER_FILE
focal_class.declarator: MANIFEST_FILE = new File(JarFile.MANIFEST_NAME)
focal_class.modifier: private static final
focal_class.original_string: private static final File MANIFEST_FILE = new File(JarFile.MANIFEST_NAME);
focal_class.type: File
focal_class.var_name: MANIFEST_FILE
focal_class.declarator: id
focal_class.modifier: private final
focal_class.original_string: private final PackageId id;
focal_class.type: PackageId
focal_class.var_name: id
focal_class.declarator: filter
focal_class.modifier: private final
focal_class.original_string: private final WorkspaceFilter filter;
focal_class.type: WorkspaceFilter
focal_class.var_name: filter
focal_class.declarator: packageType
focal_class.modifier: private final
focal_class.original_string: private final PackageType packageType;
focal_class.type: PackageType
focal_class.var_name: packageType
focal_class.file: vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/DefaultPackageInfo.java
focal_class.identifier: DefaultPackageInfo
focal_class.interfaces: implements PackageInfo
focal_class.class_method_signature: DefaultPackageInfo.DefaultPackageInfo(PackageId id, WorkspaceFilter filter, PackageType packageType)
focal_class.full_signature: public  DefaultPackageInfo(PackageId id, WorkspaceFilter filter, PackageType packageType)
focal_class.identifier: DefaultPackageInfo
focal_class.modifiers: public
focal_class.parameters: (PackageId id, WorkspaceFilter filter, PackageType packageType)
focal_class.signature:  DefaultPackageInfo(PackageId id, WorkspaceFilter filter, PackageType packageType)
focal_class.class_method_signature: DefaultPackageInfo.read(@NotNull File file)
focal_class.full_signature: public static @Nullable PackageInfo read(@NotNull File file)
focal_class.identifier: read
focal_class.modifiers: public static @Nullable
focal_class.parameters: (@NotNull File file)
focal_class.return: PackageInfo
focal_class.signature: PackageInfo read(@NotNull File file)
focal_class.class_method_signature: DefaultPackageInfo.readFromInputStream(File file, InputStream input, PackageInfo alreadyFoundInfo)
focal_class.full_signature: private static DefaultPackageInfo readFromInputStream(File file, InputStream input, PackageInfo alreadyFoundInfo)
focal_class.identifier: readFromInputStream
focal_class.modifiers: private static
focal_class.parameters: (File file, InputStream input, PackageInfo alreadyFoundInfo)
focal_class.return: DefaultPackageInfo
focal_class.signature: DefaultPackageInfo readFromInputStream(File file, InputStream input, PackageInfo alreadyFoundInfo)
focal_class.class_method_signature: DefaultPackageInfo.getId()
focal_class.full_signature: public PackageId getId()
focal_class.identifier: getId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: PackageId
focal_class.signature: PackageId getId()
focal_class.class_method_signature: DefaultPackageInfo.getFilter()
focal_class.full_signature: public WorkspaceFilter getFilter()
focal_class.identifier: getFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: WorkspaceFilter
focal_class.signature: WorkspaceFilter getFilter()
focal_class.class_method_signature: DefaultPackageInfo.getPackageType()
focal_class.full_signature: public PackageType getPackageType()
focal_class.identifier: getPackageType
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: PackageType
focal_class.signature: PackageType getPackageType()
focal_method.body: public static @Nullable PackageInfo read(@NotNull File file) throws IOException {
          DefaultPackageInfo info = new DefaultPackageInfo(null, null, PackageType.MIXED);
          if (!file.exists()) {
              throw new FileNotFoundException("Could not find file " + file);
          }
          if (file.isDirectory()) {
              for (File directoryFile : FileUtils.listFiles(file, new NameFileFilter(new String[] { "MANIFEST.MF", Constants.PROPERTIES_XML, Constants.FILTER_XML}),
                      new SuffixFileFilter(new String[] { Constants.META_INF, Constants.VAULT_DIR }))) {
                  try (InputStream input = new BufferedInputStream(new FileInputStream(directoryFile))) {
                      info = readFromInputStream(new File(file.toURI().relativize(directoryFile.toURI()).getPath()), input, info);
                      // bail out as soon as all info was found
                      if (info.getId() != null && info.getFilter() != null) {
                          break;
                      }
                  }
  
              }
              if (info.getId() == null || info.getFilter() == null) {
                  return null;
              } else {
                  return info;
              }
          } else if (file.getName().endsWith(".zip")) {
              // try to derive from vault-work?
              try (ZipFile zip = new ZipFile(file)) {
                  Enumeration<? extends ZipEntry> entries = zip.entries();
                  while (entries.hasMoreElements()) {
                      ZipEntry e = entries.nextElement();
                      try (InputStream input = zip.getInputStream(e)) {
                          info = readFromInputStream(new File(e.getName()), input, info);
                          // bail out as soon as all info was found
                          if (info.getId() != null && info.getFilter() != null) {
                              break;
                          }
                      }
                  }
              }
              if (info.getId() == null || info.getFilter() == null) {
                  return null;
              } else {
                  return info;
              }
          } else {
              throw new IOException("Only metadata from zip files could be extracted but the given file is not a zip:" + file);
          }
      }
focal_method.class_method_signature: DefaultPackageInfo.read(@NotNull File file)
focal_method.full_signature: public static @Nullable PackageInfo read(@NotNull File file)
focal_method.identifier: read
focal_method.invocations: exists isDirectory listFiles readFromInputStream getPath relativize toURI toURI getId getFilter getId getFilter endsWith getName entries hasMoreElements nextElement getInputStream readFromInputStream getName getId getFilter getId getFilter
focal_method.modifiers: public static @Nullable
focal_method.parameters: (@NotNull File file)
focal_method.return: PackageInfo
focal_method.signature: PackageInfo read(@NotNull File file)