mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
fix classpath parsing for jars with no manifest
This commit is contained in:
parent
22675e9f39
commit
cc46064bcd
1 changed files with 6 additions and 2 deletions
|
@ -21,6 +21,7 @@ import java.net.URL;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
import java.util.jar.Manifest;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -220,9 +221,12 @@ public class OSGiUtils {
|
||||||
static void collectPackagesFromJar(Path jarPath, Set<String> packages) {
|
static void collectPackagesFromJar(Path jarPath, Set<String> packages) {
|
||||||
try {
|
try {
|
||||||
try (JarFile jarFile = new JarFile(jarPath.toFile())) {
|
try (JarFile jarFile = new JarFile(jarPath.toFile())) {
|
||||||
|
Manifest manifest = jarFile.getManifest();
|
||||||
|
|
||||||
// if this jar is an OSGi bundle, use its declared exports
|
// if this jar is an OSGi bundle, use its declared exports
|
||||||
String exportPackageString =
|
String exportPackageString = manifest != null
|
||||||
jarFile.getManifest().getMainAttributes().getValue(Constants.EXPORT_PACKAGE);
|
? manifest.getMainAttributes().getValue(Constants.EXPORT_PACKAGE)
|
||||||
|
: null;
|
||||||
if (exportPackageString != null) {
|
if (exportPackageString != null) {
|
||||||
String saved = null;
|
String saved = null;
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue