예제 #1
0
 private String getBundleNameFromJar(File file) {
   try {
     return ClasspathUtil.getSymbolicName(new JarFile(file).getManifest());
   } catch (IOException e) {
     LOG.error("Can't get symbolic name from " + file, e);
     return null;
   }
 }
예제 #2
0
 private String getBundleNameFromDir(File file) {
   File current = file;
   int counter = 5;
   while (current != null && counter > 0) {
     File cand = new File(current + "/META-INF/MANIFEST.MF");
     if (cand.isFile()) {
       try {
         return ClasspathUtil.getSymbolicName(new FileInputStream(cand));
       } catch (FileNotFoundException e) {
         LOG.error("Can't get symbolic name from " + cand, e);
         return null;
       }
     }
     current = current.getParentFile();
   }
   return null;
 }