1591
1592 CodeSource canonCs = cs;
1593 URL u = cs.getLocation();
1594 if (u != null) {
1595 if (u.getProtocol().equals("jar")) {
1596 // unwrap url embedded inside jar url
1597 String spec = u.getFile();
1598 int separator = spec.indexOf("!/");
1599 if (separator != -1) {
1600 try {
1601 u = new URL(spec.substring(0, separator));
1602 } catch (MalformedURLException e) {
1603 // Fail silently. In this case, url stays what
1604 // it was above
1605 }
1606 }
1607 }
1608 if (u.getProtocol().equals("file")) {
1609 boolean isLocalFile = false;
1610 String host = u.getHost();
1611 isLocalFile = (host == null || host.equals("") ||
1612 host.equals("~") || host.equalsIgnoreCase("localhost"));
1613
1614 if (isLocalFile) {
1615 path = u.getFile().replace('/', File.separatorChar);
1616 path = ParseUtil.decode(path);
1617 }
1618 }
1619 }
1620
1621 if (path != null) {
1622 try {
1623 URL csUrl = null;
1624 path = canonPath(path);
1625 csUrl = ParseUtil.fileToEncodedURL(new File(path));
1626
1627 if (extractSignerCerts) {
1628 canonCs = new CodeSource(csUrl,
1629 getSignerCertificates(cs));
1630 } else {
1631 canonCs = new CodeSource(csUrl,
|
1591
1592 CodeSource canonCs = cs;
1593 URL u = cs.getLocation();
1594 if (u != null) {
1595 if (u.getProtocol().equals("jar")) {
1596 // unwrap url embedded inside jar url
1597 String spec = u.getFile();
1598 int separator = spec.indexOf("!/");
1599 if (separator != -1) {
1600 try {
1601 u = new URL(spec.substring(0, separator));
1602 } catch (MalformedURLException e) {
1603 // Fail silently. In this case, url stays what
1604 // it was above
1605 }
1606 }
1607 }
1608 if (u.getProtocol().equals("file")) {
1609 boolean isLocalFile = false;
1610 String host = u.getHost();
1611 isLocalFile = (host == null || host.isEmpty() ||
1612 host.equals("~") || host.equalsIgnoreCase("localhost"));
1613
1614 if (isLocalFile) {
1615 path = u.getFile().replace('/', File.separatorChar);
1616 path = ParseUtil.decode(path);
1617 }
1618 }
1619 }
1620
1621 if (path != null) {
1622 try {
1623 URL csUrl = null;
1624 path = canonPath(path);
1625 csUrl = ParseUtil.fileToEncodedURL(new File(path));
1626
1627 if (extractSignerCerts) {
1628 canonCs = new CodeSource(csUrl,
1629 getSignerCertificates(cs));
1630 } else {
1631 canonCs = new CodeSource(csUrl,
|