container/components/components/src/main/java/org/mobicents/slee/container/component/security/PolicyFileImpl.java
CodeSource performUrlConversion(CodeSource cs, boolean extractSignerCerts) {

		String path = null;
		CodeSource parsedCodeSource = null;

		URL locationURL = cs.getLocation();
		if (locationURL != null) {
			// can happen for default.
			Permission urlAccessPermission = null;
			try {
				urlAccessPermission = locationURL.openConnection().getPermission();
			} catch (IOException e) {

			}

			if (urlAccessPermission != null && urlAccessPermission instanceof FilePermission) {
				path = ((FilePermission) urlAccessPermission).getName();
			} else if ((urlAccessPermission == null) && (locationURL.getProtocol().equals("file"))) {
				path = locationURL.getFile().replace("/", File.separator);
				// FIXME: do more?
			} else {
				// FIXME: ??
			}
		}

		if (path == null) {
			if (extractSignerCerts) {
				parsedCodeSource = new CodeSource(cs.getLocation(), getSignerCertificates(cs));
			}
		} else {

			try {
				// Sun says it fails
				if (path.endsWith("*")) {
					// remove trailing '*' because it causes
					// canonicaization
					// to fail on win32
					path = path.substring(0, path.length() - 1);
					boolean removeTrailingFileSep = false;
					if (path.endsWith(File.separator))
						removeTrailingFileSep = true;
					if (path.equals("")) {
						path = System.getProperty("user.dir");
					}
					File f = new File(path);
					path = f.getCanonicalPath();
					StringBuffer sb = new StringBuffer(path);
					// reappend '*' to canonicalized filename (note that
					// canonicalization may have removed trailing file
					// separator, so we have to check for that, too)
					if (!path.endsWith(File.separator) && removeTrailingFileSep)
						sb.append(File.separator);
					sb.append('*');
					path = sb.toString();
				} else if (path.endsWith(File.separator)) {
					// this is xxxx/x.jar!/ case.....
					path = path.substring(0, path.length() - 1);
					if (path.endsWith("!")) {
						path = path.substring(0, path.length() - 1);
					}
				} else {
					path = new File(path).getCanonicalPath();
				}
				// FIXME: possible convert URL? what is check this in
				// rfc
				locationURL=fileToEncodedURL(new File(path));
				//locationURL = new URL("file", "", path);
				
				if (extractSignerCerts) {
					parsedCodeSource = new CodeSource(locationURL, getSignerCertificates(cs));
				} else {
					parsedCodeSource = new CodeSource(locationURL, cs.getCertificates());
				}
			} catch (IOException ioe) {
				// leave codesource as it is, unless we have to extract
				// its
				// signer certificates
				if (extractSignerCerts) {
					parsedCodeSource = new CodeSource(cs.getLocation(), getSignerCertificates(cs));
				}
			}

		}

		return parsedCodeSource;
		// CodeSource o = AccessController.doPrivileged(new
		// PerformURLConversionAction(extractSignerCerts,cs));

		// return o;
	}
CodeSource performUrlConversion(CodeSource cs, boolean extractSignerCerts) {

		String path = null;
		CodeSource parsedCodeSource = null;

		URL locationURL = cs.getLocation();
		if (locationURL != null) {
			// can happen for default.
			Permission urlAccessPermission = null;
			try {
				urlAccessPermission = locationURL.openConnection().getPermission();
			} catch (IOException e) {

			}

			if (urlAccessPermission != null && urlAccessPermission instanceof FilePermission) {
				path = ((FilePermission) urlAccessPermission).getName();
			} else if ((urlAccessPermission == null) && (locationURL.getProtocol().equals("file"))) {
				path = locationURL.getFile().replace("/", File.separator);
				// FIXME: do more?
			} else {
				// FIXME: ??
			}
		}

		if (path == null) {
			if (extractSignerCerts) {
				parsedCodeSource = new CodeSource(cs.getLocation(), getSignerCertificates(cs));
			}
		} else {

			try {
				// Sun says it fails
				if (path.endsWith("*")) {
					// remove trailing '*' because it causes
					// canonicaization
					// to fail on win32
					path = path.substring(0, path.length() - 1);
					boolean removeTrailingFileSep = false;
					if (path.endsWith(File.separator))
						removeTrailingFileSep = true;
					if (path.equals("")) {
						path = System.getProperty("user.dir");
					}
					File f = new File(path);
					path = f.getCanonicalPath();
					StringBuffer sb = new StringBuffer(path);
					// reappend '*' to canonicalized filename (note that
					// canonicalization may have removed trailing file
					// separator, so we have to check for that, too)
					if (!path.endsWith(File.separator) && removeTrailingFileSep)
						sb.append(File.separator);
					sb.append('*');
					path = sb.toString();
				} else if (path.endsWith(File.separator)) {
					// this is xxxx/x.jar!/ case.....
					path = path.substring(0, path.length() - 1);
					if (path.endsWith("!")) {
						path = path.substring(0, path.length() - 1);
					}
				} else {
					path = new File(path).getCanonicalPath();
				}
				// FIXME: possible convert URL? what is check this in
				// rfc
				locationURL=fileToEncodedURL(new File(path));
				//locationURL = new URL("file", "", path);
				
				if (extractSignerCerts) {
					parsedCodeSource = new CodeSource(locationURL, getSignerCertificates(cs));
				} else {
					parsedCodeSource = new CodeSource(locationURL, cs.getCertificates());
				}
			} catch (IOException ioe) {
				// leave codesource as it is, unless we have to extract
				// its
				// signer certificates
				if (extractSignerCerts) {
					parsedCodeSource = new CodeSource(cs.getLocation(), getSignerCertificates(cs));
				}
			}

		}

		return parsedCodeSource;
		// CodeSource o = AccessController.doPrivileged(new
		// PerformURLConversionAction(extractSignerCerts,cs));

		// return o;
	}
This function MUST convert code source passed. Meaning it must normalize
URL. For instance security framework may pass url that conceptualy
matches pat specified policy files but comparison wont match. See url
belowe.
<ul>
<li><b>1 -
</b>jar:file:/D:/java/servers/jboss-5.0.0.GA/server/default/deploy
/restcomm.sar/lib/jar.jar!/</li>
<li><b>2 -
</b>file:/D:/java/servers/jboss-5.0.0.GA/server/default/deploy/-</li>
</ul>
URL 1 is passed from security framework as source of loaded classes.
However it is not matched by second one (and is should)

@param cs
@return