https://bz.apache.org/bugzilla/show_bug.cgi?id=60087

--- Comment #3 from rpc1 <r...@mail.ru> ---
I reproduced error on Tomcat 8.0.x with unpackWARs="false".
Error because of the getLocation(), which returns codeBaseURL for resource
file.
Location URL is 
jar:file:/some_path/webapps/test.war!/WEB-INF/lib/bcprov-jdk16-1.46.jar, but
((JarURLConnection)url.openConnection()).getJarFile() connects to the test.war
instead bcprov-jdk16-1.46.jar, because the test.war before separator '!/'.
We need jar:war: path to access resource inside of test.war file (because it
doesn't unpack). This is example of the URL which have to be used in given
test:
jar:war:file:/some_path/webapps/test.war*/WEB-INF/lib/bcprov-jdk16-1.46.jar!/

I looked at sources and notice that getLocation() returns
AbstractArchiveResource.codeBaseUrl field, for war resources this field
generates in constructor JarWarResource, I changed constructor of
JarWarResource for codeBaseUrl:
before codeBaseUrl="jar:" + baseUrl + "!/" + archivePath
after  codeBaseUrl="jar:war:" + baseUrl + "*/" + archivePath+"!/"

I rebuilt tomcat and tried attached test, everything works fine, 
But I have doubts in solution correctness, because codeBaseUrl uses in
WebappClassLoaderBase.getPermissions() function, which gets permissions for
codeSource. In current version, for codeSource
/some_path/webapps/test.war!/WEB-INF/lib/bcprov-jdk16-1.46.jar, getPermissions
returns permission collection for test.war,  but after changes of codeBaseURL
getPermissions() returns permissions for bcprov-jdk16-1.46.jar which
located in war archive.

Could somebody confirm that changing JarWarResource's constructor is a right
solution?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to